March 2019
Intermediate to advanced
242 pages
6h 21m
English
A tab (U+0009) usually represents four whitespaces (U+0020). However, not all of the applications convert between tabs and whitespaces when they use text that includes a mix of whitespaces and tabs. To combat this challenge with the multiline text, the String class will include two methods, detab(int) and entab(int), which will convert a tab to whitespaces, and vice versa:
public String detab(int) public String entab(int)
Let's modify the preceding example, so that the content includes tabs instead of whitespaces, as follows:
String comment =
`one
of
my
favorite
lang
feature
from Amber(!)
`.detab(1);
The output of the preceding code is as follows (each tab is converted to one whitespace):
one of my favorite ...
Read now
Unlock full access