Search any characters in a string : String Search : String C# Examples


C# Examples » String » String Search »

 

Search any characters in a string









    
using  System;  
  
class  MainClass  {  
    public  static  void  Main()  {  
        string  str  =  "abcdefghijk";  
        int  idx;  
  
        char[]  chrs  =  {  'a',  'b',  'c'  };  
        idx  =  str.IndexOfAny(chrs);  
        Console.WriteLine("Index  of  first  'a',  'b',  or  'c':  "  +  idx);  
    }
}
    
   
  
   



Output

Index of first 'a', 'b', or 'c': 0


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo String
» String Search