How to remove all numbers from a string in C#

1 Answer

0 votes
using System;
using System.Text.RegularExpressions;

class Program
{
    static void Main() {
        string str = "123c#908c++674c";
        
        str = Regex.Replace(str, @"[\d-]", string.Empty);

        Console.Write(str);
    }
}




/*
run:

c#c++c

*/

 



answered Jul 2, 2022 by avibootz
...