public static bool IsWhiteSpaceOrNewLine(char32 c) { return(c == ' ' || // space c == '\t' || // horizontal tab c == '\r' || // \r c == '\n'); // \n }
public static void AppendUtf32(this StringBuilder builder, char32 utf32) { if (utf32 < 65536) { builder.Append((char)utf32); return; } utf32 -= 65536; builder.Append((char)(utf32 / 1024 + 55296)); builder.Append((char)(utf32 % 1024 + 56320)); }
public static bool IsDateTime(char32 c) { return(IsDigit(c) || c == ':' || c == '-' || c == 'Z' || c == 'T' || c == 'z' || c == 't' || c == '+' || c == '.'); }
public static bool IsDigit(char32 c) { return(c >= '0' && c <= '9'); }
public static bool IsValidUnicodeScalarValue(char32 c) { return(c >= 0 && c <= 0xD7FF || c >= 0xE000 && c < 0x10FFFF); }
public static bool IsIdentifierContinue(char32 c) { return((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); }
public static bool IsKeyContinue(char32 c) { return((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '-' || c >= '0' && c <= '9'); }
private static bool IsBinary(char32 c) { return(c == '0' || c == '1'); }
private static bool IsOctal(char32 c) { return(c >= '0' && c <= '7'); }
private static bool IsHex(char32 c) { return((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); }
public static int BinaryToDecimal(char32 c) { Debug.Assert(IsBinary(c)); return(c - '0'); }
public static int OctalToDecimal(char32 c) { Debug.Assert(IsOctal(c)); return(c - '0'); }
public static int HexToDecimal(char32 c) { Debug.Assert(IsHex(c)); return((c >= '0' && c <= '9') ? c - '0' : (c >= 'a' && c <= 'f') ? (c - 'a') + 10 : (c - 'A') + 10); }
public static bool IsNewLine(char32 c) { return(c == '\r' || // \r c == '\n'); // \n }
public static bool IsControlCharacter(char32 c) { return(c <= 0x1F || c == 0x7F); }
public static bool IsWhiteSpace(char32 c) { return(c == ' ' || // space c == '\t'); // horizontal tab }