using System.Text.RegularExpressions; public string RemoveSpecialCharacters(string str) { return Regex.Replace(str, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled); }
string dirty = "Dirty sql_ > uni^#@ unicode!"; string clean = Regex.Replace(dirty, @"([^a-zA-Z0-9_]|^\s)", string.Empty);
public static string fnRemoveSplChars(string strMyString) { StringBuilder sb = new StringBuilder(); foreach (char c in strMyString) { if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') | || (c >= 'a' && c <= 'z') ) { sb.Append(c); } } return sb.ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)