Freigeben über


String.Strip Method

Definition

Returns a string whose value is this string, with all leading and trailing Character#isWhitespace(int) white space removed.

[Android.Runtime.Register("strip", "()Ljava/lang/String;", "", ApiSince=33)]
public string Strip ();
[<Android.Runtime.Register("strip", "()Ljava/lang/String;", "", ApiSince=33)>]
member this.Strip : unit -> string

Returns

a string whose value is this string, with all leading and trailing white space removed

Attributes

Remarks

Returns a string whose value is this string, with all leading and trailing Character#isWhitespace(int) white space removed.

If this String object represents an empty string, or if all code points in this string are Character#isWhitespace(int) white space, then an empty string is returned.

Otherwise, returns a substring of this string beginning with the first code point that is not a Character#isWhitespace(int) white space up to and including the last code point that is not a Character#isWhitespace(int) white space.

This method may be used to strip Character#isWhitespace(int) white space from the beginning and end of a string.

Added in 11.

Java documentation for java.lang.String.strip().

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.

Applies to