## String::IndexOf(char_t, int, int) const method


子串中的字符向前查找。

```cpp
int System::String::IndexOf(char_t c, int startIndex, int count) const
```


| 参数 | 类型 | 描述 |
| --- | --- | --- |
| c | char_t | 要查找的字符。 |
| startIndex | int | 开始查找的索引。 |
| count | int | 要遍历的字符数。 |

### ReturnValue

自 startIndex 起的第一个字符位置索引，如果未找到则为 -1。

## 另见

* Class [String](../)
* Namespace [System](../../)
* Library [Aspose.Font for C++](../../../)
## String::IndexOf(char_t, int) const method


字符向前查找。

```cpp
int System::String::IndexOf(char_t c, int startIndex=0) const
```


| 参数 | 类型 | 描述 |
| --- | --- | --- |
| c | char_t | 要查找的字符。 |
| startIndex | int | 开始查找的索引。 |

### ReturnValue

自 startIndex 起的第一个字符位置索引，如果未找到则为 -1。

## 另见

* Class [String](../)
* Namespace [System](../../)
* Library [Aspose.Font for C++](../../../)
## String::IndexOf(const String\&, int, int) const method


子串前向查找。

```cpp
int System::String::IndexOf(const String &str, int startIndex, int count) const
```


| 参数 | 类型 | 描述 |
| --- | --- | --- |
| str | const String\& | 要查找的子字符串。 |
| startIndex | int | 在源字符串中开始查找的位置。 |
| count | int | 要查找的字符数量。 |

### ReturnValue

首次找到的子串索引，若未找到则返回 -1。对于空的查找字符串，总是返回 startIndex。

## 另见

* Class [String](../)
* Class [String](../)
* Namespace [System](../../)
* Library [Aspose.Font for C++](../../../)
## String::IndexOf(const String\&, int, System::StringComparison) const method


子串前向查找。

```cpp
int System::String::IndexOf(const String &str, int startIndex, System::StringComparison comparison_type) const
```


| 参数 | 类型 | 描述 |
| --- | --- | --- |
| str | const String\& | 要查找的子字符串。 |
| startIndex | int | 在源字符串中开始查找的位置。 |
| comparison_type | System::StringComparison | [Comparison](../../comparison/) 模式。 |

### ReturnValue

首次找到的子串索引，若未找到则返回 -1。对于空的查找字符串，总是返回 startIndex。

## 另见

* Class [String](../)
* Enum [StringComparison](../../stringcomparison/)
* Class [String](../)
* Namespace [System](../../)
* Library [Aspose.Font for C++](../../../)
## String::IndexOf(const String\&, int) const method


子串前向查找。

```cpp
int System::String::IndexOf(const String &str, int startIndex=0) const
```


| 参数 | 类型 | 描述 |
| --- | --- | --- |
| str | const String\& | 要查找的子字符串。 |
| startIndex | int | 在源字符串中开始查找的位置。 |

### ReturnValue

首次找到的子串索引，若未找到则返回 -1。对于空的查找字符串，总是返回 startIndex。

## 另见

* Class [String](../)
* Class [String](../)
* Namespace [System](../../)
* Library [Aspose.Font for C++](../../../)
## String::IndexOf(const String\&, System::StringComparison) const method


子串前向查找。

```cpp
int System::String::IndexOf(const String &str, System::StringComparison comparison_type) const
```


| 参数 | 类型 | 描述 |
| --- | --- | --- |
| str | const String\& | 要查找的子字符串。 |
| comparison_type | System::StringComparison | [Comparison](../../comparison/) 模式。 |

### ReturnValue

首次找到的子串索引，若未找到则返回 -1。对于空的查找字符串，总是返回 0。

## 另见

* Class [String](../)
* Enum [StringComparison](../../stringcomparison/)
* Class [String](../)
* Namespace [System](../../)
* Library [Aspose.Font for C++](../../../)
## String::IndexOf(const String\&, int, int, System::StringComparison) const method


子串前向查找。

```cpp
int System::String::IndexOf(const String &value, int startIndex, int count, System::StringComparison comparisonType) const
```


| 参数 | 类型 | 描述 |
| --- | --- | --- |
| 值 | const String\& | 要查找的子字符串。 |
| startIndex | int | 在源字符串中开始查找的位置。 |
| count | int | 要查找的字符数量。 |
| comparisonType | System::StringComparison | [Comparison](../../comparison/) 模式。 |

### ReturnValue

首次找到的子串索引，若未找到则返回 -1。对于空的查找字符串，总是返回 startIndex。

## 另见

* Class [String](../)
* Enum [StringComparison](../../stringcomparison/)
* Class [String](../)
* Namespace [System](../../)
* Library [Aspose.Font for C++](../../../)
