私はこのような文字列を持っています:
String orginal = "this is for test hello\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n" +
"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nhello" +
"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nhello";
ユーザーは、テキスト領域にコンテンツを入力するときに「Enter」を何度も押すため、Java では「\r\n」の多くに変更されます。私はそれを次のように変更したい:
String newStr = "this is for test hello\r\nhello\r\nhello"
どうすれば1つだけ保持できますか\r\n