Returns the index of the first occurrence of the character in the current instance.
[Visual Basic] Overloads Public Function IndexOf( _ ByVal value As Char _ ) As Integer [C#] public int IndexOf( char value ); [C++] public: int IndexOf( __wchar_t value ); [JScript] public function IndexOf( value : Char ) : int;
Value | Condition |
---|---|
The index in the string | If the character is found. |
-1 | If the character is not found. |
The IndexOf method performs a search for the first occurance of the character and marks it as an index. The search is case-sensitive and begins the indexing at zero.
String Class | String Members | System Namespace | String.IndexOf Overload List | Int32 | Char