Guest User

Untitled

a guest
Mar 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. public static string Sanitize(this string source)
  2. => Regex.Replace(source, "[^a-zA-Z0-9]|\\s", "").Trim();
  3.  
  4. public static string Sanitize(this string source, bool ignoreSpacing)
  5. => ignoreSpacing? Regex.Replace(source, "[^a-zA-Z0-9\\s]", "").Trim() : source.Sanitize();
Add Comment
Please, Sign In to add comment