slang/text/CharInfo.h file

Various character-related utilities.

Namespaces

namespace slang
Root namespace.

Functions

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