How to use method or function in C#
Name Description
String.IndexOfAny (Char[]) Reports the index of the first occurrence in this instance of any character in a specified array of Unicode characters.

Supported by the .NET Compact Framework.

String.IndexOfAny (Char[], Int32) Reports the index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position.

Supported by the .NET Compact Framework.

String.IndexOfAny (Char[], Int32, Int32) Reports the index of the first occurrence in this instance of any character in a specified array of Unicode characters. The search starts at a specified character position and examines a specified number of character positions.

Supported by the .NET Compact Framework.

 
 
using System;
//csc string_index0fAny.cs
//String.IndexOfAny(Char[], Int32)
//public int IndexOfAny (char[] anyOf, int startIndex)
namespace stringindexof
{
public class IOfTest {
public void process(string str) {

string strSource = str;
int nb = strSource.Length;
int start = 0;
Console.WriteLine("Search this String:"+ strSource + " is "+ nb +" Long ");
Console.Write("Enter Searach letter : " );
string search = Console.ReadLine();
char[] ch = search.ToCharArray();
int n2 = strSource.IndexOfAny(ch, start);
if (n2 > -1) { Console.Write("The search letter is located at : " + n2);}
else
{ Console.Write("(not found)");}
}
class test {
public static void Main()
{
Console.WriteLine("--Character Serach-----");
Console.Write("Enter a sentence : ");
string ss=Console.ReadLine();
IOfTest it = new IOfTest();
it.process(ss);
}
}
}
}