How do I delete specific characters from a particular String in Java?

后端 未结 7 1380
醉梦人生
醉梦人生 2021-02-05 00:45

For example I\'m extracting a text String from a text file and I need those words to form an array. However, when I do all that some words end with comma (,) or a full stop (.)

相关标签:
7条回答
  • 2021-02-05 01:21

    You can't modify a String in Java. They are immutable. All you can do is create a new string that is substring of the old string, minus the last character.

    In some cases a StringBuffer might help you instead.

    0 讨论(0)
提交回复
热议问题