The indent(int) method

The indent(int) method will enable developers to specify custom indentations for their multiline string values. You can pass a positive number, i, to indent(int), to add i spaces (U+0020) to your text, or you can pass a negative number, to remove a given number of whitespaces from each line of your multiline text.

An example is as follows:

String comment =  
       `one  
          of 
                  my 
           favorite 
               lang 
                   feature 
       from Amber(!)  
`.align().indent(15); 
System.out.println(comment); 

The output of the preceding code is as follows:

               one  
                  of 
                          my 
                   favorite 
                       lang 
                           feature 
               from Amber(!)  
The indent(int) method can be used to add or remove whitespaces from each line in a multitext value. By passing a positive number, you can add whitespaces, and you can remove them by passing negative values.
..................Content has been hidden....................

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