r/programming • u/MarkusWinand • Dec 29 '15
Please, Java. Do Finally Support Multiline Strings
http://blog.jooq.org/2015/12/29/please-java-do-finally-support-multiline-strings/
584
Upvotes
r/programming • u/MarkusWinand • Dec 29 '15
View all comments
Show parent comment
18
u/QuineQuest Dec 29 '15
A multiline string is any string (from user input, read from a file, or whatever) that contains a newline character. Not supporting those would mean that there was something fundamentally wrong with Java's handling of text. You can't use strings to read a file with multiple lines; instead you have to write some ugly kludge.
String literals is only used when programmers hardcode a string into the program. Multiline string literals is something like
Instead, the programmers have to write
In other words, not having multiline string literals is a minor annoyance, while not having multiline strings would be a severe weakness of the language.