Example #1
0
        public static string Remove(string content, FilterRemoveChar removeChar)
        {
            if (removeChar == null || removeChar.Chars == null || removeChar.Chars.Count <= 0)
            {
                return(content);
            }
            if (string.IsNullOrEmpty(content))
            {
                return(null);
            }

            removeChar.Chars.ForEach(f =>
            {
                if (removeChar.IsRegex)
                {
                    content = Regex.Replace(content, f, "");
                }
                else
                {
                    content = content.Replace(f, "");
                }
            });

            return(content);
        }
Example #2
0
        public static List <string> Remove(List <string> contents, FilterRemoveChar removeChar)
        {
            if (removeChar == null || removeChar.Chars == null || removeChar.Chars.Count <= 0)
            {
                return(contents);
            }
            if (contents == null || contents.Count <= 0)
            {
                return(contents);
            }

            List <string> results = new List <string>(contents.Count);
            string        res     = string.Empty;

            foreach (string con in contents)
            {
                removeChar.Chars.ForEach(f =>
                {
                    if (removeChar.IsRegex)
                    {
                        res = Regex.Replace(con, f, "");
                    }
                    else
                    {
                        res = con.Replace(f, "");
                    }
                });
                results.Add(res);
            }

            return(results);
        }