public static Boolean IsA(Char c, LJ_CHAR type) { // Make sure that we receive a character in the extended ascii range return(c > 255 ? throw new ArgumentOutOfRangeException(nameof(c), "Character is outside of the Extended ASCII range. ([0, 255])") : (CharList[c] & type) != 0); }
/// <summary> /// Will list all categories a certain character holds /// </summary> /// <param name="c"></param> /// <returns></returns> public static String Types(Char c) { if (c > 255) { throw new Exception("Character is not in the Extended ASCII range ([0, 255])."); } var enums = new LJ_CHAR[] { LJ_CHAR.GRAPH, LJ_CHAR.ALNUM, LJ_CHAR.ALPHA, LJ_CHAR.IDENT, LJ_CHAR.LOWER, LJ_CHAR.UPPER, LJ_CHAR.XDIGIT, LJ_CHAR.DIGIT, LJ_CHAR.PUNCT, LJ_CHAR.SPACE, LJ_CHAR.CNTRL }; var list = new List <String> ( ); LJ_CHAR vals = CharList[c]; foreach (LJ_CHAR @enum in enums) { if ((vals & @enum) > 0) { list.Add($"LJ_CHAR.{@enum.ToString ( )}"); } } return(list.Count > 0 ? String.Join(" | ", list) : "LJ_CHAR.NONE"); }
public static Boolean IsA(Byte c, LJ_CHAR type) { return((CharList[c] & type) != 0); }