Provides methods for manipulation of characters represented as UTF-16 code units. This is a static type with no instance services. You should never create instances of it by any means. More...

#include "char.h"

Static Public Member Functions

static Globalization::UnicodeCategory GetUnicodeCategory (char_t ch)
 Returns a value that represents a Unicode category of specified character. More...
 
static bool IsSurrogate (char_t c)
 Determines if the specified character is a UTF-16 surrogate code unit. More...
 
static ASPOSECPP_SHARED_API bool IsSurrogate (const String &s, int index)
 Determines whether the character at the specified index in the specified string is UTF-16 surrogate code unit. More...
 
static bool IsSurrogatePair (char_t highSurrogate, char_t lowSurrogate)
 Determines whether the two specified characters for a UTF-16 surrogate pair. More...
 
static ASPOSECPP_SHARED_API bool IsSurrogatePair (const String &str, int index)
 Determines whether two consequent characters in the specified character buffer are a surrogate pair. More...
 
static ASPOSECPP_SHARED_API bool IsHighSurrogate (const String &s, int index)
 Determines whether the character at the specified index in the specified string is UTF-16 high surrogate code unit. More...
 
static bool IsHighSurrogate (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is a high surrogate. More...
 
static bool IsHighSurrogate (char_t c)
 Determines whether the specified character is a high surrogate. More...
 
static bool IsLowSurrogate (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is a low surrogate. More...
 
static bool IsLowSurrogate (char_t c)
 Determines whether the specified character is a low surrogate. More...
 
static bool IsControl (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as Unicode control character. More...
 
static bool IsControl (char_t c)
 Determines whether the specified character is classified as Unicode control character. More...
 
static bool IsDigit (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as a decimal digit. More...
 
static bool IsDigit (const String &str, const int32_t idx)
 Determines whether the character at the specified index in the specified string is classified as a decimal digit. More...
 
static bool IsDigit (char_t c)
 Determines whether the specified character is classified as a decimal digit. More...
 
static bool IsLetter (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as Unicode letter. More...
 
static bool IsLetter (char_t c)
 Determines whether the specified character is classified as Unicode letter. More...
 
static bool IsLetterOrDigit (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as Unicode letter or a decimal digit. More...
 
static bool IsLetterOrDigit (char_t c)
 Determines whether the specified character is classified as Unicode letter or a decimal digit. More...
 
static bool IsNumber (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as a number. More...
 
static bool IsNumber (char_t c)
 Determines whether the specified character is classified as a number. More...
 
static bool IsSeparator (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as a separator character. More...
 
static bool IsSeparator (char_t c)
 Determines whether the specified character is classified as a separator character. More...
 
static bool IsSymbol (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as a symbol character. More...
 
static bool IsSymbol (char_t c)
 Determines whether the specified character is classified as a symbol character. More...
 
static bool IsWhiteSpace (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as a white space character. More...
 
static bool IsWhiteSpace (char_t c)
 Determines whether the specified character is classified as a white space character. More...
 
static ASPOSECPP_SHARED_API bool IsWhiteSpace (const String &str, int index)
 Determines whether the character at the specified index in the specified string is classified as a white space character. More...
 
static constexpr bool IsAsciiWhiteSpace (char_t c)
 Determines whether the specified character is classified as a ASCII white space character. More...
 
static ASPOSECPP_SHARED_API bool IsUpper (const String &str, int idx)
 Determines whether the character at the specified index in the specified string is classified as an upper case letter. More...
 
static bool IsUpper (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as an upper case letter. More...
 
static bool IsUpper (char_t c)
 Determines whether the specified character is classified as an upper case letter. More...
 
static bool IsLower (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as a lower case letter. More...
 
static bool IsLower (char_t c)
 Determines whether the specified character is classified as a lower case letter. More...
 
static ASPOSECPP_SHARED_API bool IsLower (const String &str, int idx)
 Determines whether the character at the specified index in the specified string is classified as a lower case letter. More...
 
static bool IsPunctuation (const char_t *str, int idx)
 Determines whether the character at the specified index in the specified character buffer is classified as a punctuation character. More...
 
static bool IsPunctuation (char_t c)
 Determines whether the specified character is classified as a punctuation character. More...
 
static char_t ToUpper (char_t c)
 Converts the specified character to upper case. More...
 
static char_t ToLower (char_t c)
 Converts the specified character to lower case. More...
 
static char_t ToUpper (char_t c, const SharedPtr< Globalization::CultureInfo > &ci)
 Converts the specified character to upper case. More...
 
static char_t ToLower (char_t c, const SharedPtr< Globalization::CultureInfo > &ci)
 Converts the specified character to lower case. More...
 
static char_t ToUpperInvariant (char_t c)
 Converts the specified character to upper case. More...
 
static char_t ToLowerInvariant (char_t c)
 Converts the specified character to lower case. More...
 
static String ConvertFromUtf32 (uint32_t utf32)
 Converts UTF-32 code unit into an instance of System::String class. More...
 
static int ConvertToUtf32 (char_t highSurrogate, char_t lowSurrogate)
 Converts the specified UTF-16 surrogate pair into UTF-32 code unit. More...
 
static bool TryParse (const System::String &s, char_t &result)
 Tries to convert a string consisting of a single character into UTF-16 character. The function succeeds only when input string is not null and has length of exactly one character. More...
 
static ASPOSECPP_SHARED_API double GetNumericValue (char_t c)
 Converts the specified UTF-16 character into double-precision floating-point numerical value. More...
 
static ASPOSECPP_SHARED_API char_t Parse (const String &value)
 Converts the first and the only character of the specified string to a char_t value. More...
 

Static Protected Attributes

static const uint8_t ASPOSECPP_SHARED_API s_category_table [71680]
 Table that maps Unicode characters to the Unicode categories. More...
 
static const uint32_t ASPOSECPP_SHARED_API s_category_table_astral_index [4096]
 Table that maps Unicode characters to the Unicode astral plane indexes. More...
 

Detailed Description

Provides methods for manipulation of characters represented as UTF-16 code units. This is a static type with no instance services. You should never create instances of it by any means.

Member Function Documentation

◆ ConvertFromUtf32()

static String System::Char::ConvertFromUtf32 ( uint32_t  utf32)
inlinestatic

Converts UTF-32 code unit into an instance of System::String class.

Parameters
utf32A UTF-32 code unit to convert
Returns
An instance of System::String class representing the specified UTF-32 code unit.

◆ ConvertToUtf32()

static int System::Char::ConvertToUtf32 ( char_t  highSurrogate,
char_t  lowSurrogate 
)
inlinestatic

Converts the specified UTF-16 surrogate pair into UTF-32 code unit.

Parameters
highSurrogateThe high surrogate of the UTF-16 surrogate pair to convert
lowSurrogateThe low surrogate of the UTF-16 surrogate pair to convert
Returns
A UTF-32 code unit resulting from conversion

◆ GetNumericValue()

static ASPOSECPP_SHARED_API double System::Char::GetNumericValue ( char_t  c)
static

Converts the specified UTF-16 character into double-precision floating-point numerical value.

Parameters
cUTF-16 character to convert
Returns
Numerical representation of the specified character.

◆ GetUnicodeCategory()

static Globalization::UnicodeCategory System::Char::GetUnicodeCategory ( char_t  ch)
inlinestatic

Returns a value that represents a Unicode category of specified character.

Parameters
chThe character to classify
Returns
One of the values of UnicodeCategory enum representing the Unicode category to which the specified character belongs.

◆ IsAsciiWhiteSpace()

static constexpr bool System::Char::IsAsciiWhiteSpace ( char_t  c)
inlinestatic

Determines whether the specified character is classified as a ASCII white space character.

Parameters
cThe character to test
Returns
True if the specified character is a ASCII white space character, otherwise - false

◆ IsControl() [1/2]

static bool System::Char::IsControl ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as Unicode control character.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a Unicode control character, otherwise - false

◆ IsControl() [2/2]

static bool System::Char::IsControl ( char_t  c)
inlinestatic

Determines whether the specified character is classified as Unicode control character.

Parameters
cThe character to test
Returns
True if the specified character is a Unicode control character, otherwise - false

◆ IsDigit() [1/3]

static bool System::Char::IsDigit ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as a decimal digit.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a decimal digit, otherwise - false

◆ IsDigit() [2/3]

static bool System::Char::IsDigit ( const String str,
const int32_t  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified string is classified as a decimal digit.

Parameters
strA string
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a decimal digit, otherwise - false

◆ IsDigit() [3/3]

static bool System::Char::IsDigit ( char_t  c)
inlinestatic

Determines whether the specified character is classified as a decimal digit.

Parameters
cThe character to test
Returns
True if the specified character is a decimal digit, otherwise - false

◆ IsHighSurrogate() [1/3]

static ASPOSECPP_SHARED_API bool System::Char::IsHighSurrogate ( const String s,
int  index 
)
static

Determines whether the character at the specified index in the specified string is UTF-16 high surrogate code unit.

Parameters
sA string
indexThe index in the specified string of the character to test
Returns
True if the character at the specified index is a UTF-16 high surrogate code unit, otherwise - false

◆ IsHighSurrogate() [2/3]

static bool System::Char::IsHighSurrogate ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is a high surrogate.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a high surrogate, otherwise - false

◆ IsHighSurrogate() [3/3]

static bool System::Char::IsHighSurrogate ( char_t  c)
inlinestatic

Determines whether the specified character is a high surrogate.

Parameters
cThe character to test
Returns
True if the specified character is a high surrogate, otherwise - false

◆ IsLetter() [1/2]

static bool System::Char::IsLetter ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as Unicode letter.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is Unicode letter, otherwise - false

◆ IsLetter() [2/2]

static bool System::Char::IsLetter ( char_t  c)
inlinestatic

Determines whether the specified character is classified as Unicode letter.

Parameters
cThe character to test
Returns
True if the specified character is Unicode letter, otherwise - false

◆ IsLetterOrDigit() [1/2]

static bool System::Char::IsLetterOrDigit ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as Unicode letter or a decimal digit.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is Unicode letter or a decimal digit, otherwise - false

◆ IsLetterOrDigit() [2/2]

static bool System::Char::IsLetterOrDigit ( char_t  c)
inlinestatic

Determines whether the specified character is classified as Unicode letter or a decimal digit.

Parameters
cThe character to test
Returns
True if the specified character is Unicode letter or a decimal digit, otherwise - false

◆ IsLower() [1/3]

static bool System::Char::IsLower ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as a lower case letter.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a lower case letter, otherwise - false

◆ IsLower() [2/3]

static bool System::Char::IsLower ( char_t  c)
inlinestatic

Determines whether the specified character is classified as a lower case letter.

Parameters
cThe character to test
Returns
True if the specified character is a lower case letter, otherwise - false

◆ IsLower() [3/3]

static ASPOSECPP_SHARED_API bool System::Char::IsLower ( const String str,
int  idx 
)
static

Determines whether the character at the specified index in the specified string is classified as a lower case letter.

Parameters
strA string
idxA zero-based index in the specified string to test
Returns
True if the character at the specified index is a lower case letter, otherwise - false
Exceptions
ArgumentNullExceptionIf specified string is nullptr.
ArgumentOutOfRangeExceptionIf specified index is less than zero or greater than last position in string.

◆ IsLowSurrogate() [1/2]

static bool System::Char::IsLowSurrogate ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is a low surrogate.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a low surrogate, otherwise - false

◆ IsLowSurrogate() [2/2]

static bool System::Char::IsLowSurrogate ( char_t  c)
inlinestatic

Determines whether the specified character is a low surrogate.

Parameters
cThe character to test
Returns
True if the specified character is a low surrogate, otherwise - false

◆ IsNumber() [1/2]

static bool System::Char::IsNumber ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as a number.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a number, otherwise - false

◆ IsNumber() [2/2]

static bool System::Char::IsNumber ( char_t  c)
inlinestatic

Determines whether the specified character is classified as a number.

Parameters
cThe character to test
Returns
True if the specified character is a number, otherwise - false

◆ IsPunctuation() [1/2]

static bool System::Char::IsPunctuation ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as a punctuation character.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a punctuation character, otherwise - false

◆ IsPunctuation() [2/2]

static bool System::Char::IsPunctuation ( char_t  c)
inlinestatic

Determines whether the specified character is classified as a punctuation character.

Parameters
cThe character to test
Returns
True if the specified character is a punctuation character, otherwise - false

◆ IsSeparator() [1/2]

static bool System::Char::IsSeparator ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as a separator character.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a separator character, otherwise - false

◆ IsSeparator() [2/2]

static bool System::Char::IsSeparator ( char_t  c)
inlinestatic

Determines whether the specified character is classified as a separator character.

Parameters
cThe character to test
Returns
True if the specified character is a separator character, otherwise - false

◆ IsSurrogate() [1/2]

static bool System::Char::IsSurrogate ( char_t  c)
inlinestatic

Determines if the specified character is a UTF-16 surrogate code unit.

Parameters
cA character
Returns
True if the specified character is a UTF-16 surrogate code unit, otherwise - false

◆ IsSurrogate() [2/2]

static ASPOSECPP_SHARED_API bool System::Char::IsSurrogate ( const String s,
int  index 
)
static

Determines whether the character at the specified index in the specified string is UTF-16 surrogate code unit.

Parameters
sA string
indexThe index of the character in the specified string
Returns
True if the character at the specified index is a UTF-16 surrogate code unit, otherwise - false

◆ IsSurrogatePair() [1/2]

static bool System::Char::IsSurrogatePair ( char_t  highSurrogate,
char_t  lowSurrogate 
)
inlinestatic

Determines whether the two specified characters for a UTF-16 surrogate pair.

Parameters
highSurrogateA character that is tested for being a high surrogate
lowSurrogateA character that is tested for being a low surrogate
Returns
True if the specified characters form a surrogate pair, otherwise - false

◆ IsSurrogatePair() [2/2]

static ASPOSECPP_SHARED_API bool System::Char::IsSurrogatePair ( const String str,
int  index 
)
static

Determines whether two consequent characters in the specified character buffer are a surrogate pair.

Parameters
strA string
indexA zero based index in the specified buffer at which the character sequence to test begins
Returns
True if the specified characters are a surrogate pair, otherwise - false

◆ IsSymbol() [1/2]

static bool System::Char::IsSymbol ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as a symbol character.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a symbol character, otherwise - false

◆ IsSymbol() [2/2]

static bool System::Char::IsSymbol ( char_t  c)
inlinestatic

Determines whether the specified character is classified as a symbol character.

Parameters
cThe character to test
Returns
True if the specified character is a symbol character, otherwise - false

◆ IsUpper() [1/3]

static ASPOSECPP_SHARED_API bool System::Char::IsUpper ( const String str,
int  idx 
)
static

Determines whether the character at the specified index in the specified string is classified as an upper case letter.

Parameters
strThe string containing a char.
idxA zero-based index in the specified string to test
Returns
True if the character at the specified index is an upper case letter, otherwise - false
Exceptions
ArgumentNullExceptionIf specified string is nullptr.
ArgumentOutOfRangeExceptionIf specified index is less than zero or greater than last position in string.

◆ IsUpper() [2/3]

static bool System::Char::IsUpper ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as an upper case letter.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is an upper case letter, otherwise - false

◆ IsUpper() [3/3]

static bool System::Char::IsUpper ( char_t  c)
inlinestatic

Determines whether the specified character is classified as an upper case letter.

Parameters
cThe character to test
Returns
True if the specified character is an upper case letter, otherwise - false

◆ IsWhiteSpace() [1/3]

static bool System::Char::IsWhiteSpace ( const char_t *  str,
int  idx 
)
inlinestatic

Determines whether the character at the specified index in the specified character buffer is classified as a white space character.

Parameters
strPointer to the beginning of the character buffer
idxA zero-based index in the specified buffer of the character to test
Returns
True if the character at the specified index is a white space character, otherwise - false

◆ IsWhiteSpace() [2/3]

static bool System::Char::IsWhiteSpace ( char_t  c)
inlinestatic

Determines whether the specified character is classified as a white space character.

Parameters
cThe character to test
Returns
True if the specified character is a white space character, otherwise - false

◆ IsWhiteSpace() [3/3]

static ASPOSECPP_SHARED_API bool System::Char::IsWhiteSpace ( const String str,
int  index 
)
static

Determines whether the character at the specified index in the specified string is classified as a white space character.

Parameters
strA string
indexA zero-based index in the specified string
Returns
True if the character at the specified index is a white space character, otherwise - false

◆ Parse()

static ASPOSECPP_SHARED_API char_t System::Char::Parse ( const String value)
static

Converts the first and the only character of the specified string to a char_t value.

Parameters
valueThe string to convert.
Returns
The first and the only character of the specified string if it is exactly 1 character long.

◆ ToLower() [1/2]

static char_t System::Char::ToLower ( char_t  c)
inlinestatic

Converts the specified character to lower case.

Parameters
cCharacter to convert
Returns
The specified character in lower case if the specified character is an upper case letter, otherwise - the specified character

◆ ToLower() [2/2]

static char_t System::Char::ToLower ( char_t  c,
const SharedPtr< Globalization::CultureInfo > &  ci 
)
inlinestatic

Converts the specified character to lower case.

Parameters
cCharacter to convert
ciIGNORED
Returns
The specified character in lower case if the specified character is an upper case letter, otherwise - the specified character

◆ ToLowerInvariant()

static char_t System::Char::ToLowerInvariant ( char_t  c)
inlinestatic

Converts the specified character to lower case.

Parameters
cCharacter to convert
Returns
The specified character in lower case if the specified character is an upper case letter, otherwise - the specified character

◆ ToUpper() [1/2]

static char_t System::Char::ToUpper ( char_t  c)
inlinestatic

Converts the specified character to upper case.

Parameters
cCharacter to convert
Returns
The specified character in upper case if the specified character is a lower case letter, otherwise - the specified character

◆ ToUpper() [2/2]

static char_t System::Char::ToUpper ( char_t  c,
const SharedPtr< Globalization::CultureInfo > &  ci 
)
inlinestatic

Converts the specified character to upper case.

Parameters
cCharacter to convert
ciIGNORED
Returns
The specified character in upper case if the specified character is a lower case letter, otherwise - the specified character

◆ ToUpperInvariant()

static char_t System::Char::ToUpperInvariant ( char_t  c)
inlinestatic

Converts the specified character to upper case.

Parameters
cCharacter to convert
Returns
The specified character in upper case if the specified character is a lower case letter, otherwise - the specified character

◆ TryParse()

static bool System::Char::TryParse ( const System::String s,
char_t &  result 
)
inlinestatic

Tries to convert a string consisting of a single character into UTF-16 character. The function succeeds only when input string is not null and has length of exactly one character.

Parameters
sString to convert
resultThe output variable that will contain the result of conversion if conversion succeeds
Returns
True if conversion succeeded, otherwise - false

Member Data Documentation

◆ s_category_table

const uint8_t ASPOSECPP_SHARED_API System::Char::s_category_table[71680]
staticprotected

Table that maps Unicode characters to the Unicode categories.

◆ s_category_table_astral_index

const uint32_t ASPOSECPP_SHARED_API System::Char::s_category_table_astral_index[4096]
staticprotected

Table that maps Unicode characters to the Unicode astral plane indexes.