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 int | compare (juce_wchar char1, juce_wchar char2) noexcept |
Compares two characters. More... | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static int | compare (CharPointerType1 s1, CharPointerType2 s2) noexcept |
Compares two null-terminated character strings. More... | |
static int | compareIgnoreCase (juce_wchar char1, juce_wchar char2) noexcept |
Compares two characters, using a case-independant match. More... | |
template<typename CharPointerType1 , typename CharPointerType2 > | |
static int | compareIgnoreCase (CharPointerType1 s1, CharPointerType2 s2) noexcept |
Compares two null-terminated character strings, using a case-independant match. More... | |
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. More... | |
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. More... | |
template<typename DestCharPointerType , typename SrcCharPointerType > | |
static void | copyAll (DestCharPointerType &dest, SrcCharPointerType src) noexcept |
Copies null-terminated characters from one string to another. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
template<typename Type > | |
static Type | findEndOfWhitespace (Type text) noexcept |
Returns a pointer to the first non-whitespace character in a string. More... | |
template<typename CharPointerType > | |
static size_t | findLengthWithoutTrailingZeros (CharPointerType text) |
If the input is a string representation of a floating-point number, this will find the length of the string without any trailing zeros. More... | |
template<typename CharPointerType > | |
static double | getDoubleValue (CharPointerType text) noexcept |
Parses a character string, to read a floating-point value. More... | |
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. More... | |
template<typename IntType , typename CharPointerType > | |
static IntType | getIntValue (const CharPointerType text) noexcept |
Parses a character string, to read an integer value. More... | |
static juce_wchar | getUnicodeCharFromWindows1252Codepage (uint8 windows1252Char) noexcept |
Converts a byte of Windows 1252 codepage to unicode. More... | |
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. More... | |
template<typename Type > | |
static int | indexOfChar (Type text, const juce_wchar charToFind) noexcept |
Finds the character index of a given character in another string. More... | |
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. More... | |
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. More... | |
static bool | isDigit (char character) noexcept |
Checks whether a character is a digit. More... | |
static bool | isDigit (juce_wchar character) noexcept |
Checks whether a character is a digit. More... | |
static bool | isLetter (char character) noexcept |
Checks whether a character is alphabetic. More... | |
static bool | isLetter (juce_wchar character) noexcept |
Checks whether a character is alphabetic. More... | |
static bool | isLetterOrDigit (char character) noexcept |
Checks whether a character is alphabetic or numeric. More... | |
static bool | isLetterOrDigit (juce_wchar character) noexcept |
Checks whether a character is alphabetic or numeric. More... | |
static bool | isLowerCase (juce_wchar character) noexcept |
Checks whether a unicode character is lower-case. More... | |
static bool | isPrintable (char character) noexcept |
Checks whether a character is a printable character, i.e. More... | |
static bool | isPrintable (juce_wchar character) noexcept |
Checks whether a character is a printable character, i.e. More... | |
static bool | isUpperCase (juce_wchar character) noexcept |
Checks whether a unicode character is upper-case. More... | |
static bool | isWhitespace (char character) noexcept |
Checks whether a character is whitespace. More... | |
static bool | isWhitespace (juce_wchar character) noexcept |
Checks whether a character is whitespace. More... | |
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. More... | |
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. More... | |
template<typename CharPointerType > | |
static double | readDoubleValue (CharPointerType &text) noexcept |
Parses a character string to read a floating-point number. More... | |
static juce_wchar | toLowerCase (juce_wchar character) noexcept |
Converts a character to lower-case. More... | |
static juce_wchar | toUpperCase (juce_wchar character) noexcept |
Converts a character to upper-case. More... | |
Static Private Member Functions | |
static double | mulexp10 (double value, int exponent) noexcept |
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.
{Core}
|
inlinestaticnoexcept |
Compares two characters.
Referenced by juce::CharPointer_ASCII::compare(), juce::CharPointer_UTF32::compare(), juce::CharPointer_UTF16::compare(), and juce::CharPointer_UTF8::compare().
|
inlinestaticnoexcept |
Compares two null-terminated character strings.
|
inlinestaticnoexcept |
Compares two characters, using a case-independant match.
Referenced by juce::CharPointer_ASCII::compareIgnoreCase(), juce::CharPointer_UTF32::compareIgnoreCase(), juce::CharPointer_UTF16::compareIgnoreCase(), and juce::CharPointer_UTF8::compareIgnoreCase().
|
inlinestaticnoexcept |
Compares two null-terminated character strings, using a case-independant match.
|
inlinestaticnoexcept |
Compares two null-terminated character strings, using a case-independent match.
Referenced by juce::CharPointer_ASCII::compareIgnoreCaseUpTo(), juce::CharPointer_UTF32::compareIgnoreCaseUpTo(), juce::CharPointer_UTF16::compareIgnoreCaseUpTo(), and juce::CharPointer_UTF8::compareIgnoreCaseUpTo().
|
inlinestaticnoexcept |
Compares two null-terminated character strings, up to a given number of characters.
Referenced by juce::CharPointer_ASCII::compareUpTo(), juce::CharPointer_UTF32::compareUpTo(), juce::CharPointer_UTF16::compareUpTo(), and juce::CharPointer_UTF8::compareUpTo().
|
inlinestaticnoexcept |
Copies null-terminated characters from one string to another.
Referenced by juce::CharPointer_ASCII::writeAll(), juce::CharPointer_UTF32::writeAll(), juce::CharPointer_UTF16::writeAll(), and juce::CharPointer_UTF8::writeAll().
|
inlinestaticnoexcept |
Copies characters from one string to another, up to a null terminator or a given maximum number of characters.
Referenced by juce::CharPointer_ASCII::writeWithCharLimit(), juce::CharPointer_UTF32::writeWithCharLimit(), juce::CharPointer_UTF16::writeWithCharLimit(), and juce::CharPointer_UTF8::writeWithCharLimit().
|
inlinestaticnoexcept |
Copies characters from one string to another, up to a null terminator or a given byte size limit.
References juce::getAddressDifference().
Referenced by juce::CharPointer_ASCII::writeWithDestByteLimit(), juce::CharPointer_UTF32::writeWithDestByteLimit(), juce::CharPointer_UTF16::writeWithDestByteLimit(), and juce::CharPointer_UTF8::writeWithDestByteLimit().
|
inlinestaticnoexcept |
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.
References int().
|
inlinestaticnoexcept |
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.
|
inlinestatic |
Returns a pointer to the first character in the string which is found in the breakCharacters string.
|
inlinestaticnoexcept |
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 juce::CharPointer_UTF32::findEndOfWhitespace(), juce::CharPointer_ASCII::findEndOfWhitespace(), juce::CharPointer_UTF16::findEndOfWhitespace(), and juce::CharPointer_UTF8::findEndOfWhitespace().
|
inlinestatic |
If the input is a string representation of a floating-point number, this will find the length of the string without any trailing zeros.
References int().
|
inlinestaticnoexcept |
Parses a character string, to read a floating-point value.
Referenced by juce::CharPointer_UTF32::getDoubleValue(), juce::CharPointer_ASCII::getDoubleValue(), juce::CharPointer_UTF16::getDoubleValue(), and juce::CharPointer_UTF8::getDoubleValue().
|
staticnoexcept |
Returns 0 to 16 for '0' to 'F", or -1 for characters that aren't a legal hex digit.
Referenced by juce::CharacterFunctions::HexParser< ResultType >::parse(), and juce::CppTokeniserFunctions::writeEscapeChars().
|
inlinestaticnoexcept |
Parses a character string, to read an integer value.
|
staticnoexcept |
Converts a byte of Windows 1252 codepage to unicode.
|
inlinestaticnoexcept |
Finds the character index of a given substring in another string.
Returns -1 if the substring is not found.
References int().
Referenced by juce::CharPointer_ASCII::indexOf(), juce::CharPointer_UTF32::indexOf(), juce::CharPointer_UTF16::indexOf(), and juce::CharPointer_UTF8::indexOf().
|
inlinestaticnoexcept |
Finds the character index of a given character in another string.
Returns -1 if the character is not found.
Referenced by juce::CharPointer_ASCII::indexOf(), juce::CharPointer_UTF32::indexOf(), juce::CharPointer_UTF16::indexOf(), and juce::CharPointer_UTF8::indexOf().
|
inlinestaticnoexcept |
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 juce::CharPointer_ASCII::indexOf(), juce::CharPointer_UTF32::indexOf(), juce::CharPointer_UTF16::indexOf(), and juce::CharPointer_UTF8::indexOf().
|
inlinestaticnoexcept |
Finds the character index of a given substring in another string, using a case-independent match.
Returns -1 if the substring is not found.
References int().
|
staticnoexcept |
Checks whether a character is a digit.
Referenced by juce::CharPointer_ASCII::isDigit(), juce::CharPointer_UTF32::isDigit(), and juce::CharPointer_UTF16::isDigit().
|
staticnoexcept |
Checks whether a character is a digit.
|
staticnoexcept |
Checks whether a character is alphabetic.
Referenced by juce::CppTokeniserFunctions::isIdentifierStart(), juce::CharPointer_ASCII::isLetter(), juce::CharPointer_UTF32::isLetter(), juce::CharPointer_UTF16::isLetter(), and juce::CharPointer_UTF8::isLetter().
|
staticnoexcept |
Checks whether a character is alphabetic.
|
staticnoexcept |
Checks whether a character is alphabetic or numeric.
Referenced by juce::CppTokeniserFunctions::isIdentifierBody(), juce::CharPointer_ASCII::isLetterOrDigit(), juce::CharPointer_UTF32::isLetterOrDigit(), juce::CharPointer_UTF16::isLetterOrDigit(), juce::CharPointer_UTF8::isLetterOrDigit(), and juce::CppTokeniserFunctions::skipNumberSuffix().
|
staticnoexcept |
Checks whether a character is alphabetic or numeric.
|
staticnoexcept |
Checks whether a unicode character is lower-case.
Referenced by juce::CharPointer_ASCII::isLowerCase(), juce::CharPointer_UTF32::isLowerCase(), juce::CharPointer_UTF16::isLowerCase(), and juce::CharPointer_UTF8::isLowerCase().
|
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 |
Checks whether a unicode character is upper-case.
Referenced by juce::CharPointer_ASCII::isUpperCase(), juce::CharPointer_UTF32::isUpperCase(), juce::CharPointer_UTF16::isUpperCase(), and juce::CharPointer_UTF8::isUpperCase().
|
staticnoexcept |
Checks whether a character is whitespace.
Referenced by juce::CharPointer_ASCII::isWhitespace(), juce::CharPointer_UTF32::isWhitespace(), and juce::CharPointer_UTF16::isWhitespace().
|
staticnoexcept |
Checks whether a character is whitespace.
|
inlinestaticnoexcept |
Counts the number of characters in a given string, stopping if the count exceeds a specified limit.
Referenced by juce::CharPointer_ASCII::lengthUpTo(), juce::CharPointer_UTF32::lengthUpTo(), juce::CharPointer_UTF16::lengthUpTo(), and juce::CharPointer_UTF8::lengthUpTo().
|
inlinestaticnoexcept |
Counts the number of characters in a given string, stopping if the count exceeds a specified end-pointer.
|
staticprivatenoexcept |
|
inlinestaticnoexcept |
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 int(), and JUCE_CONSTEXPR.
|
staticnoexcept |
Converts a character to lower-case.
Referenced by indexOfCharIgnoreCase(), juce::CharPointer_ASCII::toLowerCase(), juce::CharPointer_UTF32::toLowerCase(), juce::CharPointer_UTF16::toLowerCase(), and juce::CharPointer_UTF8::toLowerCase().
|
staticnoexcept |
Converts a character to upper-case.
Referenced by juce::CharPointer_ASCII::toUpperCase(), juce::CharPointer_UTF32::toUpperCase(), juce::CharPointer_UTF16::toUpperCase(), and juce::CharPointer_UTF8::toUpperCase().