Remove Dangerous Chars - CSharp System

CSharp examples for System:String Strip

Description

Remove Dangerous Chars

Demo Code


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;
        }
}

Related Tutorials