StringSegment.IndexOf 方法

定義

多載

IndexOf(Char, Int32, Int32)

取得此 StringSegment 中第一次出現 c 字元位置的以零起始索引。 搜尋會從 start 開始,並檢查指定數目的 count 字元位置。

IndexOf(Char)

取得此 StringSegment 中第一次出現 c 字元位置的以零起始索引。

IndexOf(Char, Int32)

取得此 StringSegment 中第一次出現 c 字元位置的以零起始索引。 搜尋會在 start 開始。

IndexOf(Char, Int32, Int32)

取得此 StringSegment 中第一次出現 c 字元位置的以零起始索引。 搜尋會從 start 開始,並檢查指定數目的 count 字元位置。

public:
 int IndexOf(char c, int start, int count);
public int IndexOf (char c, int start, int count);
member this.IndexOf : char * int * int -> int
Public Function IndexOf (c As Char, start As Integer, count As Integer) As Integer

參數

c
Char

要搜尋的 Unicode 字元。

start
Int32

開始搜尋的以零起始索引位置。

count
Int32

要檢查的字元數。

傳回

Int32

若找到該字元,則為從 StringSegment 開頭開始 c 的以零起始索引位置;若沒找到,則為 -1。

例外狀況

startcount 小於零,或 start + count 大於 Length

適用於

IndexOf(Char)

取得此 StringSegment 中第一次出現 c 字元位置的以零起始索引。

public:
 int IndexOf(char c);
public int IndexOf (char c);
member this.IndexOf : char -> int
Public Function IndexOf (c As Char) As Integer

參數

c
Char

要搜尋的 Unicode 字元。

傳回

Int32

若找到該字元,則為從 StringSegment 開頭開始 c 的以零起始索引位置;若沒找到,則為 -1。

適用於

IndexOf(Char, Int32)

取得此 StringSegment 中第一次出現 c 字元位置的以零起始索引。 搜尋會在 start 開始。

public:
 int IndexOf(char c, int start);
public int IndexOf (char c, int start);
member this.IndexOf : char * int -> int
Public Function IndexOf (c As Char, start As Integer) As Integer

參數

c
Char

要搜尋的 Unicode 字元。

start
Int32

開始搜尋的以零起始索引位置。

傳回

Int32

若找到該字元,則為從 StringSegment 開頭開始 c 的以零起始索引位置;若沒找到,則為 -1。

例外狀況

start 大於或等於 Length 或小於零。

適用於