C# .NET - Extracting only integer part

Asked By sreya gopal on 26-Mar-13 03:29 AM
String format is AS/78AS/1234

  How to extract only 1234(last part) from the above string
Robbe Morris replied to sreya gopal on 26-Mar-13 08:36 AM

var mystring = "AS/78AS/1234";
var lastSlash = mystring.LastIndexOf("/");

if (lastSlash > 0) mystring = mystring.Substring(lastSlash + 1);
System.Diagnostics.Debug.WriteLine(mystring);