WikiFunctions.Tools.InterwikiCount C# (CSharp) Method

InterwikiCount() public static method

Returns number of interwiki links in the text
public static InterwikiCount ( string text ) : int
text string
return int
        public static int InterwikiCount(string text)
        {
            // Performance: faster to get all wikilinks and filter on interwiki matches than simply run the regex on the whole article text
            List<string> allWikiLinks = Parsers.GetAllWikiLinks(text).FindAll(l => l.Contains(":"));
            return allWikiLinks.Count(s => SiteMatrix.Languages.Contains(WikiRegexes.PossibleInterwikis.Match(s + "]]").Groups[1].Value.ToLower()));
        }
Tools