【发布时间】:2013-03-24 14:18:48
【问题描述】:
是否可以从正在处理的字符串中删除换行符('\n')。
例如
'hello,
how are you,
that's nice.'
变成
'hello, how are you, that's nice'
谢谢
【问题讨论】:
-
您是否希望使用任何特定的语言来执行此操作?
标签: string text newline processing
是否可以从正在处理的字符串中删除换行符('\n')。
例如
'hello,
how are you,
that's nice.'
变成
'hello, how are you, that's nice'
谢谢
【问题讨论】:
标签: string text newline processing
由于它基于 Java,您可以使用 String API 中的所有方法。例如:
String s = "hello,\nhow are you,\nthat's nice.";
s = s.replace('\n', ' ');
println(s);
【讨论】: