yu.pitomets
yu.pitomets

Reputation: 1840

Replace with regular String literal in all files in Intellij

In my program we originally were using Java with Preview Features enabled, which gave as a feature to use String blocks defined in between three double quotes. For example:

String s = """
              Line one
              Line two
           """;

Now, we decided to go back to Java 14 and I need to replace those with regular String declaration in all project (which is around ~1000 occurrences). Is there a way to do that in bulk?

String s = "Line one\n"+
           "Line two\n";

Upvotes: 0

Views: 487

Answers (1)

Bas Leijdekkers
Bas Leijdekkers

Reputation: 26462

You can run the inspection "Text block can be replaced with regular string literal" inspection on your code using the "Run Inspection by Name" action. It has a quick fix to do the conversion for you.

Upvotes: 3

Related Questions