java - 删除其中包含双引号的字符串中的CRLF

时间:2016-10-12 13:24:59

标签: java

我有一个字符串,其中包含一个值 -

"01/09/2000","09:00","XX","YYYYYYYY YYYY
","XXXXXXX
XXXXXXX ",""~"31/03/2020","","BB","","",""

在上面,在Y值的中间有一个CRLF,在X值内有一个CRLF,在X值的末尾有一个CRLF。我希望从字符串中删除所有的CRLF所以它会像这样返回 -

"01/09/2000","09:00","XX","YYYYYYYYYYYY","XXXXXXXXXXXXXX",""~"31/03/2020","","BB","","",""

删除所有这些的java表达式是什么?

1 个答案:

答案 0 :(得分:0)

您可以在字符串上使用replaceAll:

String input = "A\nB";
input.replaceAll("\n", "");