String.StartsWith Method

Definition

Overloads

StartsWith(String, Int32)

Tests if the substring of this string beginning at the specified index starts with the specified prefix.

StartsWith(String)

Tests if this string starts with the specified prefix.

StartsWith(String, Int32)

Tests if the substring of this string beginning at the specified index starts with the specified prefix.

[Android.Runtime.Register("startsWith", "(Ljava/lang/String;I)Z", "")]
public bool StartsWith (string prefix, int toffset);
[<Android.Runtime.Register("startsWith", "(Ljava/lang/String;I)Z", "")>]
member this.StartsWith : string * int -> bool

Parameters

prefix
String

the prefix.

toffset
Int32

where to begin looking in this string.

Returns

true if the character sequence represented by the argument is a prefix of the substring of this object starting at index toffset; false otherwise. The result is false if toffset is negative or greater than the length of this String object; otherwise the result is the same as the result of the expression <pre> this.substring(toffset).startsWith(prefix) </pre>

Attributes

Exceptions

if prefix is null.

Remarks

Tests if the substring of this string beginning at the specified index starts with the specified prefix.

Java documentation for java.lang.String.startsWith(java.lang.String, 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.

Applies to

StartsWith(String)

Tests if this string starts with the specified prefix.

[Android.Runtime.Register("startsWith", "(Ljava/lang/String;)Z", "")]
public bool StartsWith (string prefix);
[<Android.Runtime.Register("startsWith", "(Ljava/lang/String;)Z", "")>]
member this.StartsWith : string -> bool

Parameters

prefix
String

the prefix.

Returns

true if the character sequence represented by the argument is a prefix of the character sequence represented by this string; false otherwise. Note also that true will be returned if the argument is an empty string or is equal to this String object as determined by the #equals(Object) method.

Attributes

Exceptions

if prefix is null.

Remarks

Tests if this string starts with the specified prefix.

Added in 1.0.

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

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