String.IndexOf Method (Char, Int32, Int32)

Reports the index number, or character position, of the first occurrence of the specified Unicode character in the current String object. The search starts at a specified character position and examines a specified number of character positions.

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

Syntax

[MethodImplAttribute]
public int IndexOf (
         charvalue,
         intstartIndex,
         intcount
)

Parameters

  • value
    The Unicode character you want to find.
  • startIndex
    The starting index number for the search.
  • count
    The number of character positions to be examined.

Return Value

The character position of the value parameter for the specified character if it is found, or -1 if it is not found.

Remarks

The search begins at startIndex and continues to startIndex + count - 1. Note that the character at startIndex + count is not included in the search.

Index numbering starts at 0 (zero). The search ranges from startIndex to the end of the string.

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

Version Information

Available in the .NET Micro Framework versions 1.0 and 4.1.

See Also

Reference

String Class
String Members
System Namespace