This post is more for me than anything as I keep forgetting this and it is quicker for me to 'Google' it than remember it :)

The method that you want is 'indexOf()', obviously. But it's case sensitive and its result is zero based, meaning that if it finds your letter/word within the string you are searching, 0 indicates that your letter/word was found at the very first position in your search string.

This method returns a -1 if the string you are looking for is not found.



Search String

NB: The method is case sensitive so it's wise to convert your strings to lower case to ensure you find what you are looking for.


Global ASP.NET Hosting Leader - Click Here

Add comment

  Country flag

  • Comment
  • Preview

Global ASP.NET Hosting Leader - Click Here