在java中用另一个替换String [英] replace String with another in java

查看:119
本文介绍了在java中用另一个替换String的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个函数可以用另一个字符串替换字符串?

What function can replace a string with another string?

示例#1:什么将替换HelloBrother兄弟

Example #1: What will replace "HelloBrother" with "Brother"?

示例#2:什么将取代JAVAISBEST BEST

Example #2: What will replace "JAVAISBEST" with "BEST"?

推荐答案

替换 方法正是您所需要的。

The replace method is what you're looking for.

例如:

String replacedString = someString.replace("HelloBrother", "Brother");

这篇关于在java中用另一个替换String的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆