Myre.UI.Text.StringPart.StartsWith C# (CSharp) Méthode

StartsWith() public méthode

public StartsWith ( StringPart s ) : bool
s StringPart
Résultat bool
        public bool StartsWith(StringPart s)
        {
            if (this.Length < s.Length)
                return false;

            for (int i = 0; i < s.Length; i++)
            {
                if (this[i] != s[i])
                    return false;
            }

            return true;
        }

Usage Example

Exemple #1
0
        private static TagType ParseTag(StringPart text, ref Vector2 position, ref int lineSpacing, ref int lineIndex)
        {
            var type = TagType.None;

            if (text.Equals("\n"))
            {
                NewLine(ref position, ref lineSpacing, ref lineIndex);
                type = TagType.NewLine;
            }
            else if (text.StartsWith("f:") && fonts != null)
            {
                var        fontName = text.Substring(2);
                SpriteFont font;
                if (fonts.TryParse(fontName, out font))
                {
                    PushFont(font);
                    type = TagType.FontStart;
                }
            }
            else if (text.Equals("/f"))
            {
                PopFont();
                type = TagType.FontEnd;
            }
            else if (text.StartsWith("c:"))
            {
                var   colourName = text.Substring(2);
                Color colour;
                if (ColourParser.TryParse(colourName, out colour))
                {
                    PushColour(colour);
                    type = TagType.ColourStart;
                }
            }
            else if (text.Equals("/c"))
            {
                PopColour();
                type = TagType.ColourEnd;
            }

            return(type);
        }
All Usage Examples Of Myre.UI.Text.StringPart::StartsWith