In the code below, message is a final String that have a \n
inside it, and it doesn't work.
message = format = "Blah %d Blah Blah \nBlah Blah %s Blah"
interventionSize = number
UserID = String
String.format(Dic.message,interventionSize,userID)
How can I make the line break in this case, cannot find an answer.
BTW, I cannot use any kind of framework or external jar to do that (old code) have to use Plain Old Java.
Having \n
in a format string is just fine.
Perhaps you should try a platform specific new-line. With format strings you can use %n
.
That is, try the following:
String.format(Dic.message.replace("\\n", "%n"), interventionSize, userId);
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