I need to extract an integer value from the end of a string, and I'm a little bit lost on algorithm functions/classes in C#.

Is there any sort of convenient class/function to help with this? Here is a sample string:
"omaha nebraska weather 2400"

String myString = "omaha nebraska weather 2400";
int myInt = Int32.Parse(myString.Split(' ').Last());
String myString = "omaha nebraska weather 2400";
int myInt = Int32.Parse(myString.Split(' ').Last());

I'm not entirely sure that works.

int i;
                            if(Int32.TryParse((line.Split(' ').Last()),out i))
                            {

Oh sorry my tokens are sometimes separated by tabs...

Edited 5 Years Ago by pseudorandom21: n/a

I'm not entirely sure that works.

int i;
                            if(Int32.TryParse((line.Split(' ').Last()),out i))
                            {

Oh sorry my tokens are sometimes separated by tabs...

I finally found my answer too. string[] tokens = Regex.Split(line, @"\s+");

This question has already been answered. Start a new discussion instead.