Get alphabets from Alphanumeric string

By SP

This is a small function which gives the output as a string of only alphabets from an alphanumeric string

String s = "1313256sdfhsfsd";
        int index1 = s.LastIndexOfAny(new Char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' });
        String intPart = s.Substring(0, index1);
        String stringPart = s.Substring(index1 + 1, (s.Length - index1) - 1);  

So the above stringPart will give you value = "sdfhsfsd"

Get alphabets from Alphanumeric string  (790 Views)