CSharp examples for System:String Strip
Remove Dangerous Chars
using System.Xml.Linq; using System.Web; using System.Text.RegularExpressions; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*w ww .jav a 2 s .c om*/ public class Main{ public static string RemoveDangerousChars(this string inputString) { if (string.IsNullOrEmpty(inputString)) return ""; string tmp = inputString.Replace("\\", "").Replace("--", "").Replace("=", "").Replace(">", "").Replace("<", ""); tmp = tmp.Replace("#", "").Replace("%", "").Replace("'", ""); tmp = tmp.Trim().TrimEnd().TrimStart(); return tmp; } }