Contact: aviboots(AT)netvision.net.il
41,321 questions
53,836 answers
573 users
using System; using System.Linq; class Program { public static string RemoveAllLetters(string s) { return new string(s.Where(ch => char.IsDigit(ch)).ToArray()); } static void Main() { string str = "1java23c#908c++674c"; str = RemoveAllLetters(str); Console.Write(str); } } /* run: 123908674 */
using System; using System.Text.RegularExpressions; class Program { static void Main() { string str = "1java23c#908c++674c"; str = Regex.Replace(str, "[^0-9.]", ""); Console.Write(str); } } /* run: 123908674 */