Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列に空行を追加するにはどうすればよいですか? したがって、文字列は次のようになります。
This is an example of something This is still an example of something
これになります:
UI で書式設定および表示として使用する場合は、文字列または br タグに「\n」を追加するだけです。
このようなものを使用できます。すべての「\n」を「\n\n」に置き換えます。
str = str.replaceAll("\n", "\n\n");
str は、editText から取得した文字列です。