Text cleaning and replacement: delete \n from a text in Java

后端 未结 9 1992
我在风中等你
我在风中等你 2020-12-08 19:57

I\'m cleaning an incoming text in my Java code. The text includes a lot of \"\\n\", but not as in a new line, but literally \"\\n\". I was using replaceAll() from the String

9条回答
  •  渐次进展
    2020-12-08 20:36

    I used this solution to solve that problem:

    String replacement = str.replaceAll("[\n\r]", "");
    

提交回复
热议问题