I use the following code:
if (delanaloge.equals(stari)) {
if (novi.equals("-")) {
zdruzen = " -";
} else {
zdruzen = zdruzen + " " + " - " + novi + "\r";
}
nap = true;
}
\r
is appended to create a line break, but it does not generate a line break like I expect. I would like to generate an output similar to this:
- 213
- 232
- 1321
How can I add a line break in my string?
To break a line in R Markdown and have it appear in your output, use two trailing spaces and then hit return .
To use a tab separator, use "\t", and use "\n" to create a line break.
Shift + Enter in the Console to move to a new line.
In Windows, a new line is denoted using “\r\n”, sometimes called a Carriage Return and Line Feed, or CRLF. Adding a new line in Java is as simple as including “\n” , “\r”, or “\r\n” at the end of our string.
you could use this:
public static String newline = System.getProperty("line.separator");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With