replace String with another in java

前端 未结 6 1822
孤城傲影
孤城傲影 2020-11-22 08:14

What function can replace a string with another string?

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

Example #2

6条回答
  •  梦谈多话
    2020-11-22 08:44

    The replace method is what you're looking for.

    For example:

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

提交回复
热议问题