Remove part of string in Java

后端 未结 12 1733
遥遥无期
遥遥无期 2020-11-28 04:22

I want to remove a part of string from one character, that is:

Source string:

manchester united (with nice players)

Target string:

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 04:52

    Use String.Replace():

    http://www.daniweb.com/software-development/java/threads/73139

    Example:

    String original = "manchester united (with nice players)";
    String newString = original.replace(" (with nice players)","");
    

提交回复
热议问题