Returns the index within this string of the first occurrence of the specified character. If a character with value
ch
occurs in the character sequence represented by this
String
object, then the index of the first such occurrence is returned -- that is, the smallest value
k such that:
this.charAt(k) == ch
is
true
. If no such character occurs in this string, then
-1
is returned.
@param ch a character.
@return the index of the first occurrence of the character in thecharacter sequence represented by this object, or
-1
if the character does not occur.