slang/text/CharInfo.h file

Various character-related utilities.

Namespaces

namespace slang
Root namespace.

Functions

auto isASCII(char c) -> bool constexpr
Returns whether the given character is a valid ASCII character.
auto isPrintableASCII(char c) -> bool constexpr
Returns whether the given character is considered "printable".
auto isPrintableUnicode(uint32_t c) -> bool
Returns whether the given Unicode character is considered "printable".
auto charWidthUnicode(uint32_t c) -> int
Gets the number of positions a character is likely to occupy when output on a terminal ("character width").
auto isWhitespace(char c) -> bool constexpr
Returns whether the given character is considered whitespace.
auto isNewline(char c) -> bool constexpr
Returns whether the given character is considered a new line.
auto isDecimalDigit(char c) -> bool constexpr
Returns whether the given character is considered a decimal digit.
auto isOctalDigit(char c) -> bool constexpr
Returns whether the given character is considered an octal digit.
auto isHexDigit(char c) -> bool constexpr
Returns whether the given character is considered a hexadecimal digit.
auto isBinaryDigit(char c) -> bool constexpr
Returns whether the given character is considered a binary digit.
auto isAlphaNumeric(char c) -> bool constexpr
Returns whether the given character is considered an alphanumeric character.
auto isValidCIdChar(char c) -> bool constexpr
Returns whether the given character is valid in a C language identifier.
auto isBase64Char(char c) -> bool constexpr
Returns whether the given characrer is a valid in base64 encoding.
auto isLogicDigit(char c) -> bool constexpr
Returns whether the given character is considered a special logic digit, which encompasses various ways to say Unknown (X) or High Impedance (Z).
auto getDigitValue(char c) -> uint8_t constexpr
Gets the numeric value of the given decimal digit.
auto getHexDigitValue(char c) -> uint8_t constexpr
Gets the numeric value of the given hexadecimal digit.
auto getHexForDigit(uint32_t num, bool lowerCase = false) -> char constexpr
Gets the hexadecimal character for the given number (which should be less than 16).
auto utf8Len(unsigned char first) -> int constexpr
Gets the length of the UTF-8 sequence starting with the given first character.
auto utf8Decode(const char* b, uint32_t* c, int* e, int& computedLen) -> const char* constexpr
Decode the next character, c from buf.