Example #1
0
        /// <summary>
        /// Classifies the character into normal chars, spaces, semicola, quotes,
        /// control chars.
        /// </summary>
        /// <param name="ch">a char</param>
        /// <returns>Return the character kind.</returns>
        private static UnicodeKind ClassifyCharacter(char ch)
        {
            if (Spaces.IndexOf(ch) >= 0 || (0x2000 <= ch && ch <= 0x200B))
            {
                return(UnicodeKind.Space);
            }
            if (Commas.IndexOf(ch) >= 0)
            {
                return(UnicodeKind.Comma);
            }
            if (Semicola.IndexOf(ch) >= 0)
            {
                return(UnicodeKind.Semicolon);
            }
            if (Quotes.IndexOf(ch) >= 0 || (0x3008 <= ch && ch <= 0x300F) || (0x2018 <= ch && ch <= 0x201F))
            {
                return(UnicodeKind.Quote);
            }
            if (ch < 0x0020 || Controls.IndexOf(ch) >= 0)
            {
                return(UnicodeKind.Control);
            }

            // Assume typical case.
            return(UnicodeKind.Normal);
        }
Example #2
0
 /// <summary>
 /// Classifies the character into normal chars, spaces, semicola, quotes,
 /// control chars.
 /// </summary>
 /// <param name="ch">a char</param>
 /// <returns>Return the character kind.</returns>
 private static int ClassifyCharacter(char ch)
 {
     if (Spaces.IndexOf(ch) >= 0 || (unchecked ((int)(0x2000)) <= ch && ch <= unchecked ((int)(0x200B))))
     {
         return(UckSpace);
     }
     else
     {
         if (Commas.IndexOf(ch) >= 0)
         {
             return(UckComma);
         }
         else
         {
             if (Semicola.IndexOf(ch) >= 0)
             {
                 return(UckSemicolon);
             }
             else
             {
                 if (Quotes.IndexOf(ch) >= 0 || (unchecked ((int)(0x3008)) <= ch && ch <= unchecked ((int)(0x300F))) || (unchecked ((int)(0x2018)) <= ch && ch <= unchecked ((int)(0x201F))))
                 {
                     return(UckQuote);
                 }
                 else
                 {
                     if (ch < unchecked ((int)(0x0020)) || Controls.IndexOf(ch) >= 0)
                     {
                         return(UckControl);
                     }
                     else
                     {
                         // Assume typical case.
                         return(UckNormal);
                     }
                 }
             }
         }
     }
 }