Hie... in this post you will find how to remove the special characters from string using C#.
public static string RemoveSpecialCharacters(string str)
{
return Regex.Replace(str, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled);
}
public static string RemoveSpecialCharacters(string str)
{
return Regex.Replace(str, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled);
}
in this method you created it as static.
so by using that static class.RemoveSpecialCharacters("YOURSTRING") then it returns the clean string.
No comments:
Post a Comment