在java中用另一个替换字符串 [英] replace String with another in java
本文介绍了在java中用另一个替换字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么函数可以用另一个字符串替换一个字符串?
示例 1:什么将 "HelloBrother"
替换为 "Brother"
?
示例 2:什么将 "JAVAISBEST"
替换为 "BEST"
?
解决方案
replace
方法就是你要找的.p>
例如:
String replacementString = someString.replace("HelloBrother", "Brother");
What function can replace a string with another string?
Example #1: What will replace "HelloBrother"
with "Brother"
?
Example #2: What will replace "JAVAISBEST"
with "BEST"
?
解决方案
The replace
method is what you're looking for.
For example:
String replacedString = someString.replace("HelloBrother", "Brother");
这篇关于在java中用另一个替换字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文