Exemplo n.º 1
0
        /// <summary>
        /// Tries to remove as many unwanted characters as possible for a good compaison. Allows for markdown, char faces, emojis, punctuation
        /// </summary>
        /// <param name="comment"></param>
        /// <returns></returns>
        string GeneralString(string comment)
        {
            string originalString = comment;

            //Allow comparison with certain markdown formatting
            comment = MessageModifier.RemoveMarkdownCharacters(comment);

            if (string.IsNullOrEmpty(comment))
            {
                return(comment);
            }

            string[] specificChars = new string[] { ";)", ";(", ";)", ":(", ":D", ";D" };
            for (int i = 0; i < specificChars.Length; i++)
            {
                comment = comment.Replace(specificChars[i], "");
            }

            //Allow comparison with other symbols
            comment = comment.Replace("!", "");
            comment = comment.Replace("?", "");
            comment = comment.Replace("'", "");
            comment = comment.Replace("?", "");
            comment = comment.Replace("\"", "");
            comment = comment.Replace(",", "");

            comment = MessageModifier.RemoveUnicodeCharacters(comment);
            if (string.IsNullOrEmpty(comment))
            {
                return(comment);
            }

            //Remove white space last
            comment = MessageModifier.RemoveWhiteSpaceAtStartAndEnd(comment);
            if (string.IsNullOrEmpty(comment))
            {
                return(comment);
            }

            return(comment.ToLower());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method for an accurate comparison. Ie: The comment was wrote with the intention of a reply
        /// </summary>
        /// <param name="comment"></param>
        /// <returns></returns>
        string AccurateString(string comment)
        {
            comment = MessageModifier.RemoveWhiteSpaceAtStartAndEnd(comment);

            return(comment.ToLower());
        }