String.Indent(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adjusts the indentation of each line of this string based on the value of
n
, and normalizes line termination characters.
[Android.Runtime.Register("indent", "(I)Ljava/lang/String;", "", ApiSince=34)]
public string Indent (int n);
[<Android.Runtime.Register("indent", "(I)Ljava/lang/String;", "", ApiSince=34)>]
member this.Indent : int -> string
Parameters
- n
- Int32
number of leading Character#isWhitespace(int) white space characters to add or remove
Returns
string with indentation adjusted and line endings normalized
- Attributes
Remarks
Adjusts the indentation of each line of this string based on the value of n
, and normalizes line termination characters.
This string is conceptually separated into lines using String#lines()
. Each line is then adjusted as described below and then suffixed with a line feed "\n"
(U+000A). The resulting lines are then concatenated and returned.
If n > 0
then n
spaces (U+0020) are inserted at the beginning of each line.
If n < 0
then up to n
Character#isWhitespace(int) white space characters are removed from the beginning of each line. If a given line does not contain sufficient white space then all leading Character#isWhitespace(int) white space characters are removed. Each white space character is treated as a single character. In particular, the tab character "\t"
(U+0009) is considered a single character; it is not expanded.
If n == 0
then the line remains unchanged. However, line terminators are still normalized.
Added in 12.
Java documentation for java.lang.String.indent(int)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.