src/Discord.Net.Core/Entities/Emotes/Emote.cs
/// <summary> Tries to parse an <see cref="Emote"/> from its raw format. </summary>
/// <param name="text">The raw encoding of an emote; for example, &lt;:dab:277855270321782784&gt;.</param>
/// <param name="result">An emote.</param>
Tries to parse an  from its raw format.
Tries to parse an from its raw format .
public static bool TryParse(string text, out Emote result)
        {
            result = null;
            if (text.Length >= 4 && text[0] == '<' && (text[1] == ':' || (text[1] == 'a' && text[2] == ':')) && text[text.Length - 1] == '>')
            {
                bool animated = text[1] == 'a';
                int startIndex = animated ? 3 : 2;
                int splitIndex = text.IndexOf(':', startIndex);
                if (splitIndex == -1)
                    return false;
                if (!ulong.TryParse(text.Substring(splitIndex + 1, text.Length - splitIndex - 2), NumberStyles.None, CultureInfo.InvariantCulture, out ulong id))
                    return false;
                string name = text.Substring(startIndex, splitIndex - startIndex);
                result = new Emote(id, name, animated);
                return true;
            }
            return false;
        }
public static bool TryParse ( string text , out Emote result ) { result = null ; if ( text . Length >= 4 && text [ 0 ] == ' ' && ( text [ 1 ] == ' ' || ( text [ 1 ] == ' ' && text [ 2 ] == ' ' ) ) && text [ text . Length - 1 ] == ' ' ) { bool animated = text [ 1 ] == ' ' ; int startIndex = animated ? 3 : 2 ; int splitIndex = text . IndexOf ( ' ' , startIndex ) ; if ( splitIndex == - 1 ) return false ; if ( ! ulong . TryParse ( text . Substring ( splitIndex + 1 , text . Length - splitIndex - 2 ) , NumberStyles . None , CultureInfo . InvariantCulture , out ulong id ) ) return false ; string name = text . Substring ( startIndex , splitIndex - startIndex ) ; result = new Emote ( id , name , animated ) ; return true ; } return false ; }
Tries to parse an  from its raw format.
Tries to parse an from its raw format .
text
string
None
Emote
out
result
None