Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【算法系列 - 剑指Offer】替换空格 #16

Open
AwesomeDevin opened this issue Jun 13, 2019 · 0 comments
Open

【算法系列 - 剑指Offer】替换空格 #16

AwesomeDevin opened this issue Jun 13, 2019 · 0 comments

Comments

@AwesomeDevin
Copy link
Owner

题目

请实现一个函数,将一个字符串中的每个空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。

js实现

function replaceSpace(str)
{
    // write code here
    return str.replace(/ /g,'%20')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant