Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any Future Plans for Multiline Java String

In the spirit of this question: https://stackoverflow.com/questions/1886966/java-string-declaration-occupying-multiple-lines

will there be any plans in any future version of Java to allow string continuation in the java scource?

String haveUeverSeenLorem =
  "Lorem ipsum dolor sit amet, \
  consectetur adipisicing elit, \
  sed do eiusmod tempor incididunt \
  ut labore et dolore magna aliqua.";

Either one way or another, e.g. like the above example.

like image 503
Blessed Geek Avatar asked Jul 25 '12 21:07

Blessed Geek


People also ask

Does Java support multiline strings?

The good news is that Java 15 has native support for multiline strings via Text Blocks. All the other methods reviewed can be used in Java 15 or any previous version. The code for all the methods in this article is available over on GitHub.

Can a string have multiple lines?

There are three ways to create strings that span multiple lines: By using template literals. By using the + operator – the JavaScript concatenation operator. By using the \ operator – the JavaScript backslash operator and escape character.


1 Answers

It was proposed for inclusion in Java 7 but was rejected.

It was proposed again for Java 8 but did not make it to the final version.

Java 9's JEP 213: Milling Project Coin does not include anything regarding multine strings either.

like image 86
assylias Avatar answered Oct 14 '22 04:10

assylias