你的replaceAll方法,我好像没有看到过!
解决方案 »
- 那种上网本用来学习JAVA程序够用么?
- itext 字体加粗
- 如何固定panel大小
- 急求---多线程问题
- 请教一下java工厂模式的问题
- 【求一个简单事件例子】(马上给分)
- 请问谁有J道的《J2EE实用例程EJB实用原理》?高分送上。
- 刚来到,拜山贴!呵呵
- 用过j2sdkee1.4的朋友请进!!!!!!
- Warning #: 369 : There have been deprecation warnings. Please consult the documentation for a better alternative又是什么错误啊?
- 多线程的例子。但是不知道为什么看不懂。唉,笨:(各们帮帮忙了给我解释解释
- 请问String[] args和String args[]有什么区别啊????
char first='=';
char last='$';
strRource.replace(first,last);
而且替换的也不是字符串,而是字符char
另外你的strRource写错了,应该是strSource
真难以想像居然可以编译……太奇怪了
所以你的要改为
String strSource="IceTiger=Ice+Tiger";
char first='=';
char last='$';
strSource = strSource.replace(first,last);
如果你想要替换字符串的话,比如将"str"替换为"fdq",可以对应执行3遍以上操作就是,如果替换字符串的长度不同,则这样肯定是不行的。只能一个一个处理了。
replaceAll
public String replaceAll(String regex,
String replacement)
Replaces each substring of this string that matches the given regular expression with the given replacement.
An invocation of this method of the form str.replaceAll(regex, repl) yields exactly the same result as the expression Pattern.compile(regex).matcher(str).replaceAll(repl)Parameters:
regex - the regular expression to which this string is to be matched
Returns:
The resulting String
Throws:
PatternSyntaxException - if the regular expression's syntax is invalid
NullPointerException - if regex is null
Since:
1.4
See Also:
Pattern
String first="\u003D";