It seems a bit odd that String's indexOf() method accepts an int and not a
char, is there a special reason for this?
Thanks in advance!
Ryan Stewart - 04 Apr 2004 13:59 GMT
> It seems a bit odd that String's indexOf() method accepts an int and not a
> char, is there a special reason for this?
>
> Thanks in advance!
What's the difference? str.indexOf(65) is identical to str.indexOf('A') and
both of them will compile.
Kristoffel - 04 Apr 2004 19:15 GMT
> It seems a bit odd that String's indexOf() method accepts an int and not a
> char, is there a special reason for this?
>
> Thanks in advance!
1) to do things without cast:
int i = 5;
s.indexOf ('a' + i);
2) languages that needs more than 65536 characters.