How to remove “ ” from java string

后端 未结 9 1554
遥遥无期
遥遥无期 2020-12-17 07:31

I have a java string with \" \" from a text file the program accesses with a Buffered Reader object. I have tried string.replaceAll(\" 

9条回答
  •  一向
    一向 (楼主)
    2020-12-17 08:19

    Strings in Java are immutable. You have to do:

    String newStr = cleaned.replaceAll(" ", "");
    

提交回复
热议问题