0

処理中の文字列から改行('\ n')文字を削除することは可能ですか?

例えば

'hello,
how are you,
that's nice.'

になる

'hello, how are you, that's nice'

ありがとう

4

1 に答える 1

1

Javaに基づいているため、StringAPIのすべてのメソッドを使用できます。例えば:

String s = "hello,\nhow are you,\nthat's nice.";
s = s.replace('\n', ' ');
println(s);
于 2013-03-24T15:13:00.233 に答える