Share via


String.IndexOf Method (String)

Reports the index number, or character position, of the first occurrence of the specified String object in the current String object.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax

[MethodImplAttribute]
public int IndexOf (
         string value
)

Parameters

  • value
    The String object you want to find.

Return Value

The character position of the value parameter if the specified string is found, or -1 if it is not found. If value is empty, the return value is 0 (zero).

Remarks

The search for the value parameter is both case-sensitive and culture-sensitive.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

String Class
String Members
System Namespace