March 2019
Intermediate to advanced
242 pages
6h 21m
English
When you define a multiline string value, you might choose to format the string against the left margin or align it with the indentation used by the code. The string values are stored with the margin intact. The align() method will provide incidental indentation support; it will strip off any leading or trailing blank lines, then justify each line, without losing the indentations.
The following is an example:
String comment =
`one
of
my
favorite
lang
feature
from Amber(!)
`.align();
System.out.println(comment);
The output of the preceding code is as follows:
one
of
my
favorite
lang
feature
from Amber(!)
Read now
Unlock full access