return only Digits 0-9 from a String

In .NET, you could extract just the digits from the string. Using Linq like this:

string justNumbers = new String(text.Where(Char.IsDigit).ToArray());

Don’t forget to include using System.Linq

Leave a Comment