How to get the second word from a String?

Posted by Pentium10 on Stack Overflow See other posts from Stack Overflow or by Pentium10
Published on 2010-06-02T20:47:58Z Indexed on 2010/06/02 20:54 UTC
Read the original article Hit count: 617

Filed under:

Take these examples

Smith John
Smith-Crane John
Smith-Crane John-Henry
Smith-Crane John Henry

I would like to get the John The first word after the space, but it might not be until the end, it can be until a non alpha character. How would this be in Java 1.5?

© Stack Overflow or respective owner

Related posts about java