在Java中删除双引号内的换行符

时间:2022-09-15 15:44:00

My data is in the below format

我的数据采用以下格式

1,"Hello,
World"
2,"HI,Hello" 

I need to remove the line breaks Within the double quotes from Java. The data will look like :-

我需要删除Java中双引号内的换行符。数据如下: -

1,"Hello, World"
2,"HI,Hello"

1 个解决方案

#1


1  

You just can use the String method replace(): str.replace("\"[\s\S]*\n[\s\S]*\""", "")

你可以使用String方法replace():str.replace(“\”[\ s \ S] * \ n [\ s \ S] * \“”“,”“)

#1


1  

You just can use the String method replace(): str.replace("\"[\s\S]*\n[\s\S]*\""", "")

你可以使用String方法replace():str.replace(“\”[\ s \ S] * \ n [\ s \ S] * \“”“,”“)