/// <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); }
/// <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); }
/// <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); }
/// <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); }