Management of all information about characters. More...
Static Public Member Functions | |
static int32 | DigitValue (uint32 c) |
Gets the numeric value c. | |
static uint32 | FromUTF8 (const char **in) |
Transform a UTF-8 string to an UTF-32 character. | |
static bool | IsAlNum (uint32 c) |
Determine if c is alphanumeric. | |
static bool | IsAlpha (uint32 c) |
Determine if c is alphabetic. | |
static bool | IsBase (uint32 c) |
Determine if c can be used with a diacritic. | |
static bool | IsControl (uint32 c) |
Determine if c is a control character. | |
static bool | IsDefined (uint32 c) |
Determine if c is defined. | |
static bool | IsDigit (uint32 c) |
Determine if c is numeric. | |
static bool | IsHexDigit (uint32 c) |
Determine if c is a hexadecimal digit. | |
static bool | IsLower (uint32 c) |
Determine if c is lowercase. | |
static bool | IsPrintable (uint32 c) |
Determine if c is printable. | |
static bool | IsPunctuation (uint32 c) |
Determine if c is punctuation character. | |
static bool | IsSpace (uint32 c) |
Determine if c is a space. | |
static bool | IsTitle (uint32 c) |
Determine if c is title case. | |
static bool | IsUpper (uint32 c) |
Determine if c is uppercase. | |
static bool | IsWhitespace (uint32 c) |
Determine if c is whitespace. | |
static uint32 | ToLower (uint32 c) |
Transforms c to lowercase. | |
static uint32 | ToTitle (uint32 c) |
Transforms c to title case. | |
static uint32 | ToUpper (uint32 c) |
Transforms c to uppercase. | |
static void | ToUTF8 (uint32 c, char **out) |
Transform a character to UTF-8 encoding. | |
static int8 | Type (uint32 c) |
Gets the type of a character. | |
static size_t | UTF8StringLength (const char *string) |
Counts the characters in the given NUL terminated string. | |
static size_t | UTF8StringLength (const char *string, size_t maxLength) |
Counts the characters in the given string up to maxLength characters. | |
Management of all information about characters.
This class provide a set of tools for managing the whole set of characters defined by unicode. This include information about special sets of characters such as if the character is whitespace, or alphanumeric. It also provides the uppercase equivalent of a character and determines whether a character can be ornamented with accents.
This class consists entirely of static methods, so you do not have to instantiate it. You can call one of the methods passing in the character that you want to be examined.
Note all the function work with chars encoded in UTF-32. This is not the most usual way to handle characters, but it is the fastest. To convert an UTF-8 string to an UTF-32 character use the FromUTF8() method.
Gets the numeric value c.
|
static |
Transform a UTF-8 string to an UTF-32 character.
If the string contains multiple characters, only the fist one is used. This function updates the in pointer so that it points on the next character for the following call.
|
static |
Determine if c is alphanumeric.
true
if the specified unicode character is a alphabetic or numeric character.
|
static |
Determine if c is alphabetic.
true
if the specified unicode character is an alphabetic character.
|
static |
Determine if c can be used with a diacritic.
true
if the specified unicode character is a base form character that can be used with a diacritic.
|
static |
Determine if c is a control character.
Example control characters are the non-printable ASCII characters from 0x0 to 0x1F.
true
if the specified unicode character is a control character.
|
static |
Determine if c is defined.
In unicode some codes are not valid or not attributed yet. For these codes this method will return false
.
true
if the specified unicode character is defined.
|
static |
Determine if c is numeric.
true
if the specified unicode character is a number character.
|
static |
Determine if c is a hexadecimal digit.
true
if the specified unicode character is a hexadecimal number character.
|
static |
Determine if c is lowercase.
true
if the specified unicode character is a lowercase character.
|
static |
Determine if c is printable.
Printable characters are not control characters.
true
if the specified unicode character is a printable character.
|
static |
Determine if c is punctuation character.
true
if the specified unicode character is a punctuation character.
|
static |
Determine if c is a space.
Unlike IsWhitespace() this function will return true
for non-breakable spaces. This method is useful for determining if the character will render as an empty space which can be stretched on-screen.
true
if the specified unicode character is some kind of a space character.
|
static |
Determine if c is title case.
Title case characters are a smaller version of normal uppercase letters.
true
if the specified unicode character is a title case character.
|
static |
Determine if c is uppercase.
true
if the specified unicode character is an uppercase character.
|
static |
Transforms c to lowercase.
Transforms c to title case.
Transforms c to uppercase.
|
static |
Transform a character to UTF-8 encoding.
Gets the type of a character.
unicode_char_category
enum.
|
static |
Counts the characters in the given NUL
terminated string.
NUL
terminated string.
|
static |
Counts the characters in the given string up to maxLength characters.
string | does not need to be NUL terminated if you specify a maxLength that is shorter than the maximum length of the string. |
maxLength | The maximum length of the string in bytes. |
NUL
terminated string up to maxLength characters.