WikiFunctions.Tools.DuplicateTemplateParameters C# (CSharp) Method

DuplicateTemplateParameters() public static method

Returns duplicate named parameters in a template call
public static DuplicateTemplateParameters ( string templatecall ) : int>.Dictionary
templatecall string The template call to check
return int>.Dictionary
        public static Dictionary<int, int> DuplicateTemplateParameters(string templatecall)
        {
            Dictionary<int, int> Dupes = new Dictionary<int, int>();

            Dictionary<string, string> Params = new Dictionary<string, string>();
            string pipecleanedtemplate = PipeCleanedTemplate(templatecall);

            foreach(Match m in anyParam.Matches(pipecleanedtemplate))
            {
                string paramValue = templatecall.Substring(m.Groups[2].Index, m.Groups[2].Length).Trim(),
                paramName = m.Groups[1].Value.Trim();

                if (!Params.ContainsKey(paramName))
                    Params.Add(paramName, paramValue);
                else
                    Dupes.Add(m.Index, m.Length);
            }
            return Dupes;
        }
Tools