实现一个函数把字符串中的每个空格替换成“20%”
2017-08-28 16:10
555 查看
题目:实现一个函数把字符串中的每个空格替换成“20%”。
字符替换问题,replaceAll();方法的使用输入:"hello world"
输出:hello20%20%world
java代码如下:
public class Test { public static void main(String[] args) { String string="hello world"; System.out.println(spaceReplace(string)); } private static String spaceReplace(String string) { // TODO Auto-generated method stub return string.replaceAll(" ", "20%"); } }
相关文章推荐
- 请实现一个函数,把字符串中的每个空格替换成“20%”。
- 字符串替换空格: 请实现一个函数,把字符数组中的每个空格替换成“%20”。 例如输入“we are happy.”,则输出“we are happy.”
- 实现一个函数,把字符串中的每个空格替换成”%20”
- 替换空格:请实现一个函数,把字符串中的每个空格替换成“%20”
- 【C语言】【面试题】【笔试题】.字符串替换空格:请实现一个函数,把字符串中的每个空格替换成“%20”。
- 字符串替换空格: 请实现一个函数,把字符数组中的每个空格替换成“%20”。 例如输入“we are happy.”,则输出“we%20are%20happy.”。
- 【我的算法日记】请实现一个函数,把字符串中的每个空格替换成“%20”。例如输入“We are happy.”,则输出“We%20are%20happy.”。
- 字符串替换空格:请实现一个函数,把字符数组中的每个空格替换成“%20”。
- 实现一个函数把每个空格替换成20%
- (C语言)字符串替换空格:请实现一个函数,把字符串中的每个空格替换成“%20”
- 请实现一个函数,把字符串中的每个空格替换成“%20”
- 请实现一个函数,把字符串中的每个空格替换成“ ”
- 请实现一个函数,把字符串中的每个空格替换成“%20”
- 请实现一个函数,把字符串中的每个空格替换成“%20”。例如输入“We are happy.”,则输出“We%20are%20happy.”。
- 【c语言】字符串替换空格:请实现一个函数,把字符串中的每个空格替换成“%20”
- 请实现一个函数,把字符串中的每个空格替换成“%20”。
- 字符串替换空格:请实现一个函数,把字符数组中的每个空格替换成“%20”
- 【C语言】字符串替换空格:请实现一个函数,把字符串中的每个空格替换成“%20”。
- 请实现一个函数,把字符串中的每个空格替换成“%20”。
- 【C语言】【面试题】【笔试题】.字符串替换空格:请实现一个函数,把字符串中的每个空格替换成“%20”。