What do we mean by IndexOfAny method?

 Posted by vishalneeraj-24503 on 11/3/2014 | Category: .NET Framework Interview questions | Views: 471 | Points: 40
Answer:

IndexOfAny method finds the first index of any of the char arguments. It returns -1 if none are found.It is a case-sensitive.It also return the integer value i.e. character position.We have to pass a character array as an argument.
For Example:-
string str1 = "Dot Net";

string str2 = "Funda";
int index_pos = str.IndexOfAny(new char[] { 'o', 'd' });


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response