Monday, May 24, 2010

In c# which function is used to check whether a character is present in a string. give the syntax of function?

int iPos= strSource.IndexOf(strToFind);





if ( iPos != -1 )


{


// found strToFind (which could be just a single character) inside strSource.


}

In c# which function is used to check whether a character is present in a string. give the syntax of function?
I believe it's IndexOf();





tempString.indexOf(character);





Returns -1 if it isn't in there anywhere.

sympathy flowers

No comments:

Post a Comment