Home  >  Article  >  Web Front-end  >  The sword points to offer 1, enter a string, and replace the spaces in the string with %20

The sword points to offer 1, enter a string, and replace the spaces in the string with %20

PHP中文网
PHP中文网Original
2017-07-07 18:10:241717browse

Sword refers to offer 1, enter a string, replace the spaces in the string with %20

function replaceSpace(str){
return str.replace(/\s/g,"%20");
}
replaceSpace("we are right")

The above is the detailed content of The sword points to offer 1, enter a string, and replace the spaces in the string with %20. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn