Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Preview Raw String Literals in IntelliJ IDEA 2018.3

DZone's Guide to

Preview Raw String Literals in IntelliJ IDEA 2018.3

Raw string literals are ready for you to preview in IntelliJ IDEA 2018.3 Beta! Check out this article to see how to try this brand new support in the upcoming IntelliJ IDEA 2018.3.

· Java Zone ·
Free Resource

Get the Edge with a Professional Java IDE. 30-day free trial.

Our drive to develop has taken us into the fast lane, and just look at us go! Even though Java 11 has just come out, we're already adding initial support for Java 12 in our upcoming IntelliJ IDEA 2018.3!

Raw string literals (JEP 326) are ready for you to preview in IntelliJ IDEA 2018.3 Beta. To take advantage of coding assistance for Java 12, set the language level to "12 (Preview) - Switch expression, raw string literals" in the Project Structure dialog.

You can also run your application on JDK 12, by simply setting the Project SDK to JDK 12.

The IDE provides a quick fix to convert multi-line string literals to raw string literals, and vice versa:

If your code happens to have redundant leading or trailing backticks (`) around a value in the raw string literals, IntelliJ IDEA detects this and provides a corresponding quick fix.

We've extended the functionality that previously worked only for string literals, and now the IDE can also recognize regular expressions in raw string literals.

Spell-checking works inside raw string literals, as well.

Now, you can paste a string with line separators not only as a string literal but also as a raw string literal. The quotes will be adjusted according to the content of the raw string literal.

We've also extended the functionality of the intention that breaks a string literal and made it work for raw string literals too.

Please note that even though JEP 326 is targeted at JDK 12, it is still a preview feature. This means that according to JEP 12, it is "fully specified and fully implemented, and yet impermanent." If its implementation changes in an upcoming release of Java, we'll make sure to reflect such a change in IntelliJ IDEA as well.

Try this brand new support for raw string literals in the upcoming IntelliJ IDEA 2018.3 and do give us your feedback! Please share your thoughts via the discussion forum, our issue tracker, or on Twitter!

Get the Java IDE that understands code & makes developing enjoyable. Level up your code with IntelliJ IDEA. Download the free trial.

Topics:
java ,raw string literals ,intellij idea

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}