예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cp"></param>
        /// <returns></returns>
        public static char ToCharacter(this CharWithPosition cp)
        {
            char result = '\0';

            if (cp != null)
            {
                result = cp.Character;
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cp"></param>
        /// <param name="ch"></param>
        /// <returns></returns>
        public static bool AreEqual(this CharWithPosition cp, char ch)
        {
            bool result = false;

            if (cp != null)
            {
                result = cp.Character == ch;
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        /// 转换为位置,如果为null,则返回-1
        /// </summary>
        /// <param name="cp"></param>
        /// <returns></returns>
        public static int ToPosition(this CharWithPosition cp)
        {
            int result = -1;

            if (cp != null)
            {
                result = cp.Position;
            }

            return(result);
        }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="cp"></param>
 /// <param name="ch"></param>
 /// <returns></returns>
 public static bool AreNotEqual(this CharWithPosition cp, char ch)
 {
     return(AreNotEqual(cp, ch) == false);
 }