StringExtensionsIndexOfAny(String, String) Method

Gets the zero-based index of the first occurrence in the specified String s of any of the strings in the specified set by case sensitive ordinal comparison.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.1.0
C#
public static int IndexOfAny(
	this string s,
	params string[] set
)

Parameters

s  String
A String instance that is to be compared to each element of the set.
set  String
An Array of strings.

Return Value

Int32
The zero-based index of the first occurrence in the specified String s of any of the strings in the specified set, or -1 if none of the strings of set are found in s.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullExceptions is
-or-
set is .
ArgumentExceptionsetcontains a element.

See Also