The detab(int) and entab methods

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 
   lang 
 feature 
 from Amber(!)  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.172.130