Acrolinx.Sdk.Sidebar.Util.Adapter.UniversalAdapter.DecodedLength C# (CSharp) Метод

DecodedLength() приватный Метод

private DecodedLength ( string text ) : int
text string
Результат int
        private int DecodedLength(string text)
        {
            // Workaround required as the parser does not provide offset information.
            // Calculate length considering the offset shifts caused by the entities.
            System.Text.RegularExpressions.MatchCollection entities = System.Text.RegularExpressions.Regex.Matches(text, "&\\w+?;");
            var length = 0;
            var lastMatchEnd = 0;
            foreach (System.Text.RegularExpressions.Match match in entities)
            {
                length += match.Index - lastMatchEnd;
                lastMatchEnd = match.Index + match.Length;
                var resolvedEntity = XmlDecode(match.Value);
                length += resolvedEntity.Length;
            }
            length += text.Length - lastMatchEnd;
            return length;
        }