由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 有没有 replaceall for String?
相关主题
why doesn't replaceAll work?那个快?
问个String:replaceALL的问题java beginner question
有什么办法高效的进行replaceAllwrong!!! Re: 有没有 replaceall for String?
java 截取一部分stringRe: wrong!!! Re: 有没有 replaceall for Stri
我自己编了个Java面试题问一个Java regexp的题
如何确保每次读入的字符串都是unique的java str.replaceAll("\n", "") doesn't work
一个Java程序员的话(3)java问题:如何match两个正规表达式
Question on JSP ELjava string stream
相关话题的讨论汇总
话题: string话题: replace话题: replaceall话题: java话题: efg
进入Java版参与讨论
1 (共1页)
l********r
发帖数: 140
1
以前用MFC的CString, 有 replace(string, string),
可是java好象没有啊.
Java String.replace is for single char replace only.
String.replaceAll is for pattern only.
How can I replace, for example, replace all the "abc" with "efg" in a given
string? (or place ", >" with "," in a given string)
Thanks a lot.
c**g
发帖数: 274
2
Can you read document? as a developer, reading document is even
not considered as a basic skill (probably reading code is), no mention
JDK document is crystal clear. Pattern = Regular Expression.
String s = "abcadfsafd abc";
s.replaceAll("abc", "efg");

【在 l********r 的大作中提到】
: 以前用MFC的CString, 有 replace(string, string),
: 可是java好象没有啊.
: Java String.replace is for single char replace only.
: String.replaceAll is for pattern only.
: How can I replace, for example, replace all the "abc" with "efg" in a given
: string? (or place ", >" with "," in a given string)
: Thanks a lot.

1 (共1页)
进入Java版参与讨论
相关主题
java string stream我自己编了个Java面试题
出个简单题,看你Java APi熟悉到什么程度如何确保每次读入的字符串都是unique的
火车旅行家在中文WINDOWS下无法运行的大问题已被解决一个Java程序员的话(3)
Re: Question on mouse click on image in Jdk 1.1Question on JSP EL
why doesn't replaceAll work?那个快?
问个String:replaceALL的问题java beginner question
有什么办法高效的进行replaceAllwrong!!! Re: 有没有 replaceall for String?
java 截取一部分stringRe: wrong!!! Re: 有没有 replaceall for Stri
相关话题的讨论汇总
话题: string话题: replace话题: replaceall话题: java话题: efg