Language

TextUtils.IndexOf Method

Definition

Overloads

Name Description
IndexOf(String, String, Int32, Int32)

Finds a character sequence within the specified text range.

IndexOf(String, Char, Int32, Int32)

Finds a character within the specified text range.

IndexOf(ICharSequence, Char, Int32, Int32)

Finds a character within the specified text range.

IndexOf(String, String, Int32)

Finds a character sequence at or after the specified index.

IndexOf(String, Char, Int32)

Finds a character at or after the specified index.

IndexOf(ICharSequence, ICharSequence, Int32, Int32)

Finds a character sequence within the specified text range.

IndexOf(ICharSequence, ICharSequence, Int32)

Finds a character sequence at or after the specified index.

IndexOf(ICharSequence, ICharSequence)

Finds the first occurrence of a character sequence.

IndexOf(ICharSequence, Char)

Finds the first occurrence of a character.

IndexOf(ICharSequence, Char, Int32)

Finds a character at or after the specified index.

IndexOf(String, String)

Finds the first occurrence of a character sequence.

IndexOf(String, Char)

Finds the first occurrence of a character.

IndexOf(String, String, Int32, Int32)

Finds a character sequence within the specified text range.

public static int IndexOf(string? s, string? needle, int start, int end);
static member IndexOf : string * string * int * int -> int

Parameters

s
String

The text to search.

needle
String

The sequence of characters to find.

start
Int32

The first character index at which to look for a match.

end
Int32

The exclusive end offset that a nonempty match must not cross.

Returns

The first matching index, or -1 if no match exists. An empty search sequence returns start.

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(String, Char, Int32, Int32)

Finds a character within the specified text range.

public static int IndexOf(string? s, char ch, int start, int end);
static member IndexOf : string * char * int * int -> int

Parameters

s
String

The text to search.

ch
Char

The character to find.

start
Int32

The first character index to include in the search.

end
Int32

The character index at which the search stops, excluding that character.

Returns

The first matching index in the range, or -1 if the range has no match.

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(ICharSequence, Char, Int32, Int32)

Finds a character within the specified text range.

[Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;CII)I", "")]
public static int IndexOf(Java.Lang.ICharSequence? s, char ch, int start, int end);
[<Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;CII)I", "")>]
static member IndexOf : Java.Lang.ICharSequence * char * int * int -> int

Parameters

s
ICharSequence

The text to search.

ch
Char

The character to find.

start
Int32

The first character index to include in the search.

end
Int32

The character index at which the search stops, excluding that character.

Returns

The first matching index in the range, or -1 if the range has no match.

Attributes

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(String, String, Int32)

Finds a character sequence at or after the specified index.

public static int IndexOf(string? s, string? needle, int start);
static member IndexOf : string * string * int -> int

Parameters

s
String

The text to search.

needle
String

The sequence of characters to find.

start
Int32

The first character index at which to look for a match.

Returns

The first matching index, or -1 if no match exists. An empty search sequence returns start.

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(String, Char, Int32)

Finds a character at or after the specified index.

public static int IndexOf(string? s, char ch, int start);
static member IndexOf : string * char * int -> int

Parameters

s
String

The text to search.

ch
Char

The character to find.

start
Int32

The first character index at which to look for a match.

Returns

The first matching character index at or after start, or -1 if no match exists.

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(ICharSequence, ICharSequence, Int32, Int32)

Finds a character sequence within the specified text range.

[Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;II)I", "")]
public static int IndexOf(Java.Lang.ICharSequence? s, Java.Lang.ICharSequence? needle, int start, int end);
[<Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;II)I", "")>]
static member IndexOf : Java.Lang.ICharSequence * Java.Lang.ICharSequence * int * int -> int

Parameters

s
ICharSequence

The text to search.

needle
ICharSequence

The sequence of characters to find.

start
Int32

The first character index at which to look for a match.

end
Int32

The exclusive end offset that a nonempty match must not cross.

Returns

The first matching index, or -1 if no match exists. An empty search sequence returns start.

Attributes

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(ICharSequence, ICharSequence, Int32)

Finds a character sequence at or after the specified index.

[Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;I)I", "")]
public static int IndexOf(Java.Lang.ICharSequence? s, Java.Lang.ICharSequence? needle, int start);
[<Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;I)I", "")>]
static member IndexOf : Java.Lang.ICharSequence * Java.Lang.ICharSequence * int -> int

Parameters

s
ICharSequence

The text to search.

needle
ICharSequence

The sequence of characters to find.

start
Int32

The first character index at which to look for a match.

Returns

The first matching index, or -1 if no match exists. An empty search sequence returns start.

Attributes

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(ICharSequence, ICharSequence)

Finds the first occurrence of a character sequence.

[Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)I", "")]
public static int IndexOf(Java.Lang.ICharSequence? s, Java.Lang.ICharSequence? needle);
[<Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)I", "")>]
static member IndexOf : Java.Lang.ICharSequence * Java.Lang.ICharSequence -> int

Parameters

s
ICharSequence

The text to search.

needle
ICharSequence

The sequence of characters to find.

Returns

The first matching index, or -1 if no match exists. An empty search sequence returns zero.

Attributes

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(ICharSequence, Char)

Finds the first occurrence of a character.

[Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;C)I", "")]
public static int IndexOf(Java.Lang.ICharSequence? s, char ch);
[<Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;C)I", "")>]
static member IndexOf : Java.Lang.ICharSequence * char -> int

Parameters

s
ICharSequence

The text to search.

ch
Char

The character to find.

Returns

The first matching character index, or -1 if the character is absent.

Attributes

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(ICharSequence, Char, Int32)

Finds a character at or after the specified index.

[Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;CI)I", "")]
public static int IndexOf(Java.Lang.ICharSequence? s, char ch, int start);
[<Android.Runtime.Register("indexOf", "(Ljava/lang/CharSequence;CI)I", "")>]
static member IndexOf : Java.Lang.ICharSequence * char * int -> int

Parameters

s
ICharSequence

The text to search.

ch
Char

The character to find.

start
Int32

The first character index at which to look for a match.

Returns

The first matching character index at or after start, or -1 if no match exists.

Attributes

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(String, String)

Finds the first occurrence of a character sequence.

public static int IndexOf(string? s, string? needle);
static member IndexOf : string * string -> int

Parameters

s
String

The text to search.

needle
String

The sequence of characters to find.

Returns

The first matching index, or -1 if no match exists. An empty search sequence returns zero.

Remarks

Android reference for android.text.TextUtils.indexOf.

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

IndexOf(String, Char)

Finds the first occurrence of a character.

public static int IndexOf(string? s, char ch);
static member IndexOf : string * char -> int

Parameters

s
String

The text to search.

ch
Char

The character to find.

Returns

The first matching character index, or -1 if the character is absent.

Remarks

Android reference for android.text.TextUtils.indexOf.

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