示例#1
0
        /// <summary>
        /// ASCIIs to unicode callback.
        /// </summary>
        /// <param name="match">The match.</param>
        /// <returns>Returns the converted string</returns>
        private static string AsciiToUnicodeCallback(Match match)
        {
            // check if the emoji exists in our dictionaries
            var ascii = match.Value;

            return(ASCII_TO_CODEPOINT.ContainsKey(ascii) ? ToUnicode(ASCII_TO_CODEPOINT[ascii]) : match.Value);

            // we didn't find a replacement so just return the entire match
        }
示例#2
0
        private static string AsciiToUnicodeCallback(Match match)
        {
            // check if the emoji exists in our dictionaries
            var ascii = match.Value;

            if (ASCII_TO_CODEPOINT.ContainsKey(ascii))
            {
                // convert codepoint to unicode char
                return(ToUnicode(ASCII_TO_CODEPOINT[ascii]));
            }
            // we didn't find a replacement so just return the entire match
            return(match.Value);
        }
示例#3
0
        private static string AsciiToShortnameCallback(Match match)
        {
            // check if the emoji exists in our dictionaries
            var ascii = match.Value;

            if (ASCII_TO_CODEPOINT.ContainsKey(ascii))
            {
                var codepoint = ASCII_TO_CODEPOINT[ascii];
                if (CODEPOINT_TO_SHORTNAME.ContainsKey(codepoint))
                {
                    return(CODEPOINT_TO_SHORTNAME[codepoint]);
                }
            }
            // we didn't find a replacement so just return the entire match
            return(match.Value);
        }