CalDavSynchronizer.Conversions.Msft.HtmlCssParser.ParseCssSize C# (CSharp) Метод

ParseCssSize() приватный статический Метод

private static ParseCssSize ( string styleValue, int &nextIndex, bool mustBeNonNegative ) : string
styleValue string
nextIndex int
mustBeNonNegative bool
Результат string
        private static string ParseCssSize(string styleValue, ref int nextIndex, bool mustBeNonNegative)
        {
            ParseWhiteSpace(styleValue, ref nextIndex);

            int startIndex = nextIndex;

            // Parse optional munis sign
            if (nextIndex < styleValue.Length && styleValue[nextIndex] == '-')
            {
                nextIndex++;
            }

            if (nextIndex < styleValue.Length && Char.IsDigit(styleValue[nextIndex]))
            {
                while (nextIndex < styleValue.Length && (Char.IsDigit(styleValue[nextIndex]) || styleValue[nextIndex] == '.'))
                {
                    nextIndex++;
                }

                string number = styleValue.Substring(startIndex, nextIndex - startIndex);

                string unit = ParseWordEnumeration(_fontSizeUnits, styleValue, ref nextIndex);
                if (unit == null)
                {
                    unit = "px"; // Assuming pixels by default
                }

                if (mustBeNonNegative && styleValue[startIndex] == '-')
                {
                    return "0";
                }
                else
                {
                    return number + unit;
                }
            }

            return null;
        }

Same methods

HtmlCssParser::ParseCssSize ( string styleValue, int &nextIndex, Hashtable localValues, string propertyName, bool mustBeNonNegative ) : void