Share via


String.IndexOfAny Method (Char[], Int32, Int32)

Reports the index number, or character position, of the first occurrence in the current String object of any character within a specified array of Unicode characters. 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 IndexOfAny (
         char[] anyOf,
         intstartIndex,
         intcount
)

Parameters

  • anyOf
    An array of Unicode characters, any one or more of whose characters you want to find in the current String object.
  • startIndex
    The starting index number for the search.
  • count
    The number of character positions to be examined.

Return Value

The character position of the first occurrence in the current String object of any character within the specified array, or -1 if no such character is found.

Remarks

The search begins at startIndex and continues to startIndex + count -1. 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 anyOf 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, and 4.1.

See Also

Reference

String Class
String Members
System Namespace