Replace new line/return with space using regex

前端 未结 7 1793
醉梦人生
醉梦人生 2020-12-24 06:36

Pretty basic question for someone who knows.

Instead of getting from

\"This is my text. 

And here is a ne         


        
7条回答
  •  鱼传尺愫
    2020-12-24 06:50

    Try

    L.replaceAll("(\\t|\\r?\\n)+", " ");
    

    Depending on the system a linefeed is either \r\n or just \n.

提交回复
热议问题