WikiFunctions.Tools.RemoveMatches C# (CSharp) Method

RemoveMatches() public static method

Removes every matched pattern. To be used only if MatchCollection is needed for something else, otherwise Regex.Replace(foo, "") will be faster
public static RemoveMatches ( string str, IList matches ) : string
str string String to process
matches IList List of matches of a regex on this string
return string
        public static string RemoveMatches(string str, IList<Match> matches)
        {
            if (matches.Count == 0) return str;

            StringBuilder sb = new StringBuilder(str);

            for (int i = matches.Count - 1; i >= 0; i--)
            {
                sb.Remove(matches[i].Index, matches[i].Value.Length);
            }

            return sb.ToString();
        }

Same methods

Tools::RemoveMatches ( string str, MatchCollection matches ) : string
Tools