wrong!!! Re: 有没有 replaceall for String?# Java - 爪哇娇娃
l*r
1 楼
But you are wrong. The regular expression has a number of predefined
string/chars that you can NOT use.
Take a simple example:
String t1="FREE Tech Newsletters, Instant Messaging Planet Text, ");
t1=t1.toLowerCase();
String t2=t1.replaceAll(", .", ". ");
System.out.println(t2);
this will result in:
FREE Tech Newsletters. nstant Messaging Planet Text.
(the correct results one would expect --- if according to what you said,
should be the same string as t1.)
The problem is: we want to replace a sub
string/chars that you can NOT use.
Take a simple example:
String t1="FREE Tech Newsletters, Instant Messaging Planet Text, ");
t1=t1.toLowerCase();
String t2=t1.replaceAll(", .", ". ");
System.out.println(t2);
this will result in:
FREE Tech Newsletters. nstant Messaging Planet Text.
(the correct results one would expect --- if according to what you said,
should be the same string as t1.)
The problem is: we want to replace a sub