Skip to main content

Java String

Indent

Will add a trailing newline. For example:

String str = """
Hello
World""";
str.indent(2) + "a";

Result is

  Hello
World
a

Instead of

    Hello
Worlda