Created
June 8, 2023 08:42
-
-
Save chuongmep/0bc2c6399969e92a227cfd33103582a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string RemoveSpecialCharacters( string str) | |
{ | |
StringBuilder sb = new StringBuilder(); | |
foreach (char c in str) | |
{ | |
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || | |
(c >= 'a' && c <= 'z') || c == '_' || c == '-' || c == '.' || c==' ') | |
{ | |
sb.Append(c); | |
} | |
} | |
return sb.ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment