Click or drag to resize
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: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
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: Int32
The zero-based index position of value if that character is found, or -1 if it is not.
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionstartIndex is less than zero or greater than the length of the string.
See Also