A collection of functions for manipulating characters and character strings. More...
#include <juce_CharacterFunctions.h>
Classes | |
struct | HexParser |
Parses a character string, to read a hexadecimal value. More... | |
Static Public Member Functions | |
static juce_wchar | toUpperCase (juce_wchar character) noexcept |
Converts a character to upper-case. | |
static juce_wchar | toLowerCase (juce_wchar character) noexcept |
Converts a character to lower-case. | |
static bool | isUpperCase (juce_wchar character) noexcept |
Checks whether a unicode character is upper-case. | |
static bool | isLowerCase (juce_wchar character) noexcept |
Checks whether a unicode character is lower-case. | |
static bool | isWhitespace (char character) noexcept |
Checks whether a character is whitespace. | |
static bool | isWhitespace (juce_wchar character) noexcept |
Checks whether a character is whitespace. | |
static bool | isDigit (char character) noexcept |
Checks whether a character is a digit. | |
static bool | isDigit (juce_wchar character) noexcept |
Checks whether a character is a digit. | |
static bool | isLetter (char character) noexcept |
Checks whether a character is alphabetic. | |
static bool | isLetter (juce_wchar character) noexcept |
Checks whether a character is alphabetic. | |
static bool | isLetterOrDigit (char character) noexcept |
Checks whether a character is alphabetic or numeric. | |
static bool | isLetterOrDigit (juce_wchar character) noexcept |
Checks whether a character is alphabetic or numeric. | |
static bool | isPrintable (char character) noexcept |
Checks whether a character is a printable character, i.e. | |
static bool | isPrintable (juce_wchar character) noexcept |
Checks whether a character is a printable character, i.e. | |
static int | getHexDigitValue (juce_wchar digit) noexcept |
Returns 0 to 16 for '0' to 'F", or -1 for characters that aren't a legal hex digit. | |
static juce_wchar | getUnicodeCharFromWindows1252Codepage (uint8 windows1252Char) noexcept |
Converts a byte of Windows 1252 codepage to unicode. | |
static constexpr bool | isPartOfBasicMultilingualPlane (juce_wchar character) noexcept |
Returns true if a unicode code point is part of the basic multilingual plane. | |
static constexpr bool | isAscii (juce_wchar character) noexcept |
Returns true if a unicode code point is in the range os ASCII characters. | |
static constexpr bool | isAsciiControlCharacter (juce_wchar character) noexcept |
Returns true if a unicode code point is in the range of ASCII control characters. | |
static constexpr bool | isSurrogate (juce_wchar character) noexcept |
Returns true if a unicode code point is in the range of UTF-16 surrogate code units. | |
static constexpr bool | isHighSurrogate (juce_wchar character) noexcept |
Returns true if a unicode code point is in the range of UTF-16 high surrogate code units. | |
static constexpr bool | isLowSurrogate (juce_wchar character) noexcept |
Returns true if a unicode code point is in the range of UTF-16 low surrogate code units. | |
static constexpr bool | isNonSurrogateCodePoint (juce_wchar character) noexcept |
Returns true if a unicode code point is in the range of valid unicode code points. | |
template<typename CharPointerType > | |
static double | readDoubleValue (CharPointerType &text) noexcept |
Parses a character string to read a floating-point number. | |
template<typename CharPointerType > | |
static double | getDoubleValue (CharPointerType text) noexcept |
Parses a character string, to read a floating-point value. | |
template<typename IntType , typename CharPointerType > | |
static IntType | getIntValue (const CharPointerType text) noexcept |
Parses a character string, to read an integer value. | |
template<typename CharPointerType > | |
static size_t | lengthUpTo (CharPointerType text, const size_t maxCharsToCount) noexcept |
Counts the number of characters in a given string, stopping if the count exceeds a specified limit. | |
template<typename CharPointerType > | |
static size_t | lengthUpTo (CharPointerType start, const CharPointerType end) noexcept |
Counts the number of characters in a given string, stopping if the count exceeds a specified end-pointer. | |
template<typename DestCharPointerType , typename SrcCharPointerType > | |
static void | copyAll (DestCharPointerType &dest, SrcCharPointerType src) noexcept |
Copies null-terminated characters from one string to another. | |
template<typename DestCharPointerType , typename SrcCharPointerType > | |
static size_t | copyWithDestByteLimit (DestCharPointerType &dest, SrcCharPointerType src, size_t maxBytesToWrite) noexcept |
Copies characters from one string to another, up to a null terminator or a given byte size limit. | |
template<typename DestCharPointerType , typename SrcCharPointerType > | |
static void | copyWithCharLimit (DestCharPointerType &dest, SrcCharPointerType src, int maxChars) noexcept |
Copies characters from one string to another, up to a null terminator or a given maximum number of characters. | |
static int | compare (juce_wchar char1, juce_wchar char2) noexcept |
Compares two characters. | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static int | compare (CharPointerType1 s1, CharPointerType2 s2) noexcept |
Compares two null-terminated character strings. | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static int | compareUpTo (CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept |
Compares two null-terminated character strings, up to a given number of characters. | |
static int | compareIgnoreCase (juce_wchar char1, juce_wchar char2) noexcept |
Compares two characters, using a case-independant match. | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static int | compareIgnoreCase (CharPointerType1 s1, CharPointerType2 s2) noexcept |
Compares two null-terminated character strings, using a case-independant match. | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static int | compareIgnoreCaseUpTo (CharPointerType1 s1, CharPointerType2 s2, int maxChars) noexcept |
Compares two null-terminated character strings, using a case-independent match. | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static int | indexOf (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept |
Finds the character index of a given substring in another string. | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static CharPointerType1 | find (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept |
Returns a pointer to the first occurrence of a substring in a string. | |
template<typename CharPointerType > | |
static CharPointerType | find (CharPointerType textToSearch, const juce_wchar charToLookFor) noexcept |
Returns a pointer to the first occurrence of a substring in a string. | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static int | indexOfIgnoreCase (CharPointerType1 haystack, const CharPointerType2 needle) noexcept |
Finds the character index of a given substring in another string, using a case-independent match. | |
template<typename Type > | |
static int | indexOfChar (Type text, const juce_wchar charToFind) noexcept |
Finds the character index of a given character in another string. | |
template<typename Type > | |
static int | indexOfCharIgnoreCase (Type text, juce_wchar charToFind) noexcept |
Finds the character index of a given character in another string, using a case-independent match. | |
template<typename Type > | |
static void | incrementToEndOfWhitespace (Type &text) noexcept |
Increments a pointer until it points to the first non-whitespace character in a string. | |
template<typename Type > | |
static Type | findEndOfWhitespace (Type text) noexcept |
Returns a pointer to the first non-whitespace character in a string. | |
template<typename Type , typename BreakType > | |
static Type | findEndOfToken (Type text, BreakType breakCharacters, Type quoteCharacters) |
Returns a pointer to the first character in the string which is found in the breakCharacters string. | |
A collection of functions for manipulating characters and character strings.
Most of these methods are designed for internal use by the String and CharPointer classes, but some of them may be useful to call directly.
|
staticnoexcept |
Converts a character to upper-case.
Referenced by CharPointer_ASCII::toUpperCase(), CharPointer_UTF16::toUpperCase(), CharPointer_UTF32::toUpperCase(), and CharPointer_UTF8::toUpperCase().
|
staticnoexcept |
Converts a character to lower-case.
Referenced by indexOfCharIgnoreCase(), CharPointer_ASCII::toLowerCase(), CharPointer_UTF16::toLowerCase(), CharPointer_UTF32::toLowerCase(), and CharPointer_UTF8::toLowerCase().
|
staticnoexcept |
Checks whether a unicode character is upper-case.
Referenced by CharPointer_ASCII::isUpperCase(), CharPointer_UTF16::isUpperCase(), CharPointer_UTF32::isUpperCase(), and CharPointer_UTF8::isUpperCase().
|
staticnoexcept |
Checks whether a unicode character is lower-case.
Referenced by CharPointer_ASCII::isLowerCase(), CharPointer_UTF16::isLowerCase(), CharPointer_UTF32::isLowerCase(), and CharPointer_UTF8::isLowerCase().
|
staticnoexcept |
Checks whether a character is whitespace.
Referenced by CharPointer_ASCII::isWhitespace(), CharPointer_UTF16::isWhitespace(), CharPointer_UTF32::isWhitespace(), and CharPointer_UTF8::isWhitespace().
|
staticnoexcept |
Checks whether a character is whitespace.
|
staticnoexcept |
Checks whether a character is a digit.
Referenced by CharPointer_ASCII::isDigit(), CharPointer_UTF16::isDigit(), and CharPointer_UTF32::isDigit().
|
staticnoexcept |
Checks whether a character is a digit.
|
staticnoexcept |
Checks whether a character is alphabetic.
Referenced by CppTokeniserFunctions::isIdentifierStart(), CharPointer_ASCII::isLetter(), CharPointer_UTF16::isLetter(), CharPointer_UTF32::isLetter(), and CharPointer_UTF8::isLetter().
|
staticnoexcept |
Checks whether a character is alphabetic.
|
staticnoexcept |
Checks whether a character is alphabetic or numeric.
Referenced by CppTokeniserFunctions::isIdentifierBody(), CharPointer_ASCII::isLetterOrDigit(), CharPointer_UTF16::isLetterOrDigit(), CharPointer_UTF32::isLetterOrDigit(), CharPointer_UTF8::isLetterOrDigit(), and CppTokeniserFunctions::skipNumberSuffix().
|
staticnoexcept |
Checks whether a character is alphabetic or numeric.
|
staticnoexcept |
Checks whether a character is a printable character, i.e.
alphabetic, numeric, a punctuation character or a space.
|
staticnoexcept |
Checks whether a character is a printable character, i.e.
alphabetic, numeric, a punctuation character or a space.
|
staticnoexcept |
Returns 0 to 16 for '0' to 'F", or -1 for characters that aren't a legal hex digit.
Referenced by CharacterFunctions::HexParser< ResultType >::parse(), and CppTokeniserFunctions::writeEscapeChars().
|
staticnoexcept |
Converts a byte of Windows 1252 codepage to unicode.
|
staticconstexprnoexcept |
Returns true if a unicode code point is part of the basic multilingual plane.
|
staticconstexprnoexcept |
Returns true if a unicode code point is in the range os ASCII characters.
Referenced by CharPointer_ASCII::canRepresent(), and CharPointer_UTF8::isValidString().
|
staticconstexprnoexcept |
Returns true if a unicode code point is in the range of ASCII control characters.
|
staticconstexprnoexcept |
Returns true if a unicode code point is in the range of UTF-16 surrogate code units.
|
staticconstexprnoexcept |
Returns true if a unicode code point is in the range of UTF-16 high surrogate code units.
Referenced by CharPointer_UTF16::isValidString().
|
staticconstexprnoexcept |
Returns true if a unicode code point is in the range of UTF-16 low surrogate code units.
Referenced by CharPointer_UTF16::isValidString().
|
staticconstexprnoexcept |
Returns true if a unicode code point is in the range of valid unicode code points.
Referenced by CharPointer_UTF16::canRepresent(), CharPointer_UTF32::canRepresent(), and CharPointer_UTF8::canRepresent().
|
staticnoexcept |
Parses a character string to read a floating-point number.
Note that this will advance the pointer that is passed in, leaving it at the end of the number.
References JUCE_FALLTHROUGH.
|
staticnoexcept |
Parses a character string, to read a floating-point value.
Referenced by CharPointer_ASCII::getDoubleValue(), CharPointer_UTF16::getDoubleValue(), CharPointer_UTF32::getDoubleValue(), and CharPointer_UTF8::getDoubleValue().
|
staticnoexcept |
Parses a character string, to read an integer value.
Referenced by CharPointer_UTF16::getIntValue32(), CharPointer_UTF32::getIntValue32(), CharPointer_ASCII::getIntValue64(), CharPointer_UTF16::getIntValue64(), and CharPointer_UTF32::getIntValue64().
|
staticnoexcept |
Counts the number of characters in a given string, stopping if the count exceeds a specified limit.
Referenced by CharPointer_ASCII::lengthUpTo(), CharPointer_ASCII::lengthUpTo(), CharPointer_UTF16::lengthUpTo(), CharPointer_UTF16::lengthUpTo(), CharPointer_UTF32::lengthUpTo(), CharPointer_UTF32::lengthUpTo(), CharPointer_UTF8::lengthUpTo(), and CharPointer_UTF8::lengthUpTo().
|
staticnoexcept |
Counts the number of characters in a given string, stopping if the count exceeds a specified end-pointer.
References end().
|
staticnoexcept |
Copies null-terminated characters from one string to another.
Referenced by CharPointer_ASCII::writeAll(), CharPointer_UTF16::writeAll(), CharPointer_UTF32::writeAll(), and CharPointer_UTF8::writeAll().
|
staticnoexcept |
Copies characters from one string to another, up to a null terminator or a given byte size limit.
References getAddressDifference().
Referenced by CharPointer_ASCII::writeWithDestByteLimit(), CharPointer_UTF16::writeWithDestByteLimit(), CharPointer_UTF32::writeWithDestByteLimit(), and CharPointer_UTF8::writeWithDestByteLimit().
|
staticnoexcept |
Copies characters from one string to another, up to a null terminator or a given maximum number of characters.
Referenced by CharPointer_ASCII::writeWithCharLimit(), CharPointer_UTF16::writeWithCharLimit(), CharPointer_UTF32::writeWithCharLimit(), and CharPointer_UTF8::writeWithCharLimit().
|
staticnoexcept |
Compares two characters.
Referenced by CharPointer_ASCII::compare(), CharPointer_UTF16::compare(), CharPointer_UTF32::compare(), and CharPointer_UTF8::compare().
|
staticnoexcept |
Compares two null-terminated character strings.
|
staticnoexcept |
Compares two null-terminated character strings, up to a given number of characters.
Referenced by CharPointer_ASCII::compareUpTo(), CharPointer_UTF16::compareUpTo(), CharPointer_UTF32::compareUpTo(), and CharPointer_UTF8::compareUpTo().
|
staticnoexcept |
Compares two characters, using a case-independant match.
Referenced by CharPointer_ASCII::compareIgnoreCase(), CharPointer_ASCII::compareIgnoreCase(), CharPointer_UTF16::compareIgnoreCase(), CharPointer_UTF32::compareIgnoreCase(), CharPointer_UTF8::compareIgnoreCase(), and CharPointer_UTF8::compareIgnoreCase().
|
staticnoexcept |
Compares two null-terminated character strings, using a case-independant match.
|
staticnoexcept |
Compares two null-terminated character strings, using a case-independent match.
Referenced by CharPointer_ASCII::compareIgnoreCaseUpTo(), CharPointer_UTF16::compareIgnoreCaseUpTo(), CharPointer_UTF32::compareIgnoreCaseUpTo(), and CharPointer_UTF8::compareIgnoreCaseUpTo().
|
staticnoexcept |
Finds the character index of a given substring in another string.
Returns -1 if the substring is not found.
Referenced by CharPointer_ASCII::indexOf(), CharPointer_UTF16::indexOf(), CharPointer_UTF32::indexOf(), and CharPointer_UTF8::indexOf().
|
staticnoexcept |
Returns a pointer to the first occurrence of a substring in a string.
If the substring is not found, this will return a pointer to the string's null terminator.
|
staticnoexcept |
Returns a pointer to the first occurrence of a substring in a string.
If the substring is not found, this will return a pointer to the string's null terminator.
|
staticnoexcept |
Finds the character index of a given substring in another string, using a case-independent match.
Returns -1 if the substring is not found.
|
staticnoexcept |
Finds the character index of a given character in another string.
Returns -1 if the character is not found.
Referenced by CharPointer_ASCII::indexOf(), CharPointer_UTF16::indexOf(), CharPointer_UTF16::indexOf(), CharPointer_UTF32::indexOf(), CharPointer_UTF8::indexOf(), and CharPointer_UTF8::indexOf().
|
staticnoexcept |
Finds the character index of a given character in another string, using a case-independent match.
Returns -1 if the character is not found.
References toLowerCase().
Referenced by CharPointer_ASCII::indexOf(), CharPointer_UTF16::indexOf(), CharPointer_UTF32::indexOf(), and CharPointer_UTF8::indexOf().
|
staticnoexcept |
Increments a pointer until it points to the first non-whitespace character in a string.
If the string contains only whitespace, the pointer will point to the string's null terminator.
Referenced by CharPointer_ASCII::incrementToEndOfWhitespace(), CharPointer_UTF16::incrementToEndOfWhitespace(), CharPointer_UTF32::incrementToEndOfWhitespace(), and CharPointer_UTF8::incrementToEndOfWhitespace().
|
staticnoexcept |
Returns a pointer to the first non-whitespace character in a string.
If the string contains only whitespace, this will return a pointer to its null terminator.
Referenced by CharPointer_ASCII::findEndOfWhitespace(), CharPointer_UTF16::findEndOfWhitespace(), CharPointer_UTF32::findEndOfWhitespace(), and CharPointer_UTF8::findEndOfWhitespace().
|
static |
Returns a pointer to the first character in the string which is found in the breakCharacters string.