Remove non alphanumeric characters from string
suggest changepublic string Remove()
{
string input = "Hello./!";
return Regex.Replace(input, "[^a-zA-Z0-9]", "");
}
[^a-zA-Z0-9] keeps only ASCII letters and digits. Spaces and letters outside that range are removed.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents