JIM.H. <JI**@discussions.microsoft.com> wrote:
I have this string 111_XYZ11_2345, 22_zz22_33, .., How can I extract only
last numbers like 2345 and 33.
Are you asking for "everything after the last _" or "everything after
the second _"? It makes a difference when you've got more than 2 _
characters in the input string :)
To get everything after the second _, use String.IndexOf twice,
starting the search after the first _ to find the second _. Then use
String.Substring.
To get everything after the last _, use String.LastIndexOf, and then
use String.Substring.
In each case, you should check the result of String.IndexOf - if it's
-1, the _ character wasn't found.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too