StringIndexOf Method (Char, Int32) |
Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts at a specified character position.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public int IndexOf(
char value,
int startIndex
)
Parameters
- value
- Type: SystemChar
A Unicode character to seek. - startIndex
- Type: SystemInt32
The search starting position.
Return Value
Type:
Int32The zero-based index position of
value if that character is found, or -1 if it is not.
Exceptions Exception | Condition |
---|
ArgumentOutOfRangeException | startIndex is less than zero or greater than the length of the string. |
See Also