[Logo]
Forums Register Login
String method....
public int indexOf(int ch, int fromIndex)
*if the fromIndex is greater than the length of the string wats the
effect....
*if the fromIndex is equal to the length of the string wats the
effect....
*if the fromIndex is negative wats the effect....
There is no restriction on the value of fromIndex. If it is negative, it has the same effect as if it were zero: this entire string may be searched. If it is greater than the length of this string, it has the same effect as if it were equal to the length of this string: -1 is returned.
hope this sample code will help your understanding!!!




And the output is as follows:

Index equals String Length: -1
Index greater than String Length: -1
Index is negative: 5


Thanks
Balaji.S
Can u explain it more....
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Dec 11, 2017 06:27:52.