Get the Integer from the end of a string (variable length)

Posted by black666 on Stack Overflow See other posts from Stack Overflow or by black666
Published on 2010-04-12T08:00:03Z Indexed on 2010/04/12 8:03 UTC
Read the original article Hit count: 130

Filed under:

I have a string of a variable length and at the end of the string are some digits. What would be the best / efficient way, to parse the string and get the number from the end as an Integer?

The String and the digits at the end can can be of any length. For example:

abcd123 --> 123 abc12345 --> 12345 ab4cd1 --> 1

© Stack Overflow or respective owner

Related posts about java