CSharp examples for System:String Strip
Remove the specified string.
/*// ww w . j a va 2s. co m * $Id: StringUtils.cs 465 2008-10-15 11:53:17Z spocke $ * * Copyright ? 2007, Moxiecode Systems AB, All rights reserved. */ using System.Text.RegularExpressions; using System.Text; using System; public class Main{ /// <summary> /// Senitizes the specified string. /// </summary> /// <param name="str">String to sanitize.</param> /// <returns>Sanitized string.</returns> public static string Sanitize(string str) { if (str == null) return null; return Regex.Replace(str, @"[^0-9a-z\-_,]+", ""); } }