Splitting String Literals on Newline Symbols
You can split a string literal on newline symbols (
\n) by using the Break string on '\n' intention action. That is, a string literal in a code fragment like this:
String s = "Hello,\nWorld!";
can be easily transformed into corresponding concatenation:
String s = "Hello,\n" + "World!";
To do that:
- Place the cursor within the literal of interest.
- Click the yellow light bulb icon or press Alt+Enter, and select Break string on '\n'.
Last modified: 18 July 2017