That part of the code looks ok. I suspect it is something after that which
gives you the problem - what else do you do with p? Remember indexOf returns
-1 if the substring is not found. This means that if you then use p to try
checking the name of the email like:
String namePart = em.substring(0, p);
you will get an IndexOutOfBoundsException.
ChrisC
> This piece of code don't work if the '@' is not found:
>
> String em = usuario.getEmail();
> int p = em.indexOf('@');
> out.println(Integer.toString(p));
>
> if the '@' is within the string, it works well. Why?
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>