JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Static Public Member Functions
CharacterFunctions Class Reference

A collection of functions for manipulating characters and character strings. More...

List of all members.

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 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.
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 int copyWithDestByteLimit (DestCharPointerType &dest, SrcCharPointerType src, int maxBytes) 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.
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.
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 haystack, const CharPointerType2 &needle) noexcept
 Finds the character index of a given substring in another 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 Type findEndOfWhitespace (const Type &text) noexcept
 Returns a pointer to the first non-whitespace character in a string.
template<typename Type >
static Type findEndOfToken (const Type &text, const Type &breakCharacters, const Type &quoteCharacters)
 Returns a pointer to the first character in the string which is found in the breakCharacters string.

Detailed Description

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.

See also:
String, CharPointer_UTF8, CharPointer_UTF16, CharPointer_UTF32

Member Function Documentation

static juce_wchar CharacterFunctions::toUpperCase ( juce_wchar  character) [static]

Converts a character to upper-case.

static juce_wchar CharacterFunctions::toLowerCase ( juce_wchar  character) [static]

Converts a character to lower-case.

Referenced by indexOfCharIgnoreCase().

static bool CharacterFunctions::isUpperCase ( juce_wchar  character) [static]

Checks whether a unicode character is upper-case.

static bool CharacterFunctions::isLowerCase ( juce_wchar  character) [static]

Checks whether a unicode character is lower-case.

static bool CharacterFunctions::isWhitespace ( char  character) [static]

Checks whether a character is whitespace.

static bool CharacterFunctions::isWhitespace ( juce_wchar  character) [static]

Checks whether a character is whitespace.

static bool CharacterFunctions::isDigit ( char  character) [static]

Checks whether a character is a digit.

static bool CharacterFunctions::isDigit ( juce_wchar  character) [static]

Checks whether a character is a digit.

static bool CharacterFunctions::isLetter ( char  character) [static]

Checks whether a character is alphabetic.

static bool CharacterFunctions::isLetter ( juce_wchar  character) [static]

Checks whether a character is alphabetic.

static bool CharacterFunctions::isLetterOrDigit ( char  character) [static]

Checks whether a character is alphabetic or numeric.

static bool CharacterFunctions::isLetterOrDigit ( juce_wchar  character) [static]

Checks whether a character is alphabetic or numeric.

static int CharacterFunctions::getHexDigitValue ( juce_wchar  digit) [static]

Returns 0 to 16 for '0' to 'F", or -1 for characters that aren't a legal hex digit.

template<typename CharPointerType >
static double CharacterFunctions::readDoubleValue ( CharPointerType &  text) [static]

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 findEndOfWhitespace().

template<typename CharPointerType >
static double CharacterFunctions::getDoubleValue ( CharPointerType  text) [static]

Parses a character string, to read a floating-point value.

template<typename IntType , typename CharPointerType >
static IntType CharacterFunctions::getIntValue ( const CharPointerType &  text) [static]

Parses a character string, to read an integer value.

template<typename CharPointerType >
static size_t CharacterFunctions::lengthUpTo ( CharPointerType  text,
const size_t  maxCharsToCount 
) [static]

Counts the number of characters in a given string, stopping if the count exceeds a specified limit.

template<typename CharPointerType >
static size_t CharacterFunctions::lengthUpTo ( CharPointerType  start,
const CharPointerType &  end 
) [static]

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 CharacterFunctions::copyAll ( DestCharPointerType &  dest,
SrcCharPointerType  src 
) [static]

Copies null-terminated characters from one string to another.

Referenced by CharPointer_ASCII::writeAll(), CharPointer_UTF32::writeAll(), CharPointer_UTF16::writeAll(), and CharPointer_UTF8::writeAll().

template<typename DestCharPointerType , typename SrcCharPointerType >
static int CharacterFunctions::copyWithDestByteLimit ( DestCharPointerType &  dest,
SrcCharPointerType  src,
int  maxBytes 
) [static]

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_UTF32::writeWithDestByteLimit(), CharPointer_UTF16::writeWithDestByteLimit(), and CharPointer_UTF8::writeWithDestByteLimit().

template<typename DestCharPointerType , typename SrcCharPointerType >
static void CharacterFunctions::copyWithCharLimit ( DestCharPointerType &  dest,
SrcCharPointerType  src,
int  maxChars 
) [static]

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_UTF32::writeWithCharLimit(), CharPointer_UTF16::writeWithCharLimit(), and CharPointer_UTF8::writeWithCharLimit().

template<typename CharPointerType1 , typename CharPointerType2 >
static int CharacterFunctions::compare ( CharPointerType1  s1,
CharPointerType2  s2 
) [static]

Compares two null-terminated character strings.

template<typename CharPointerType1 , typename CharPointerType2 >
static int CharacterFunctions::compareUpTo ( CharPointerType1  s1,
CharPointerType2  s2,
int  maxChars 
) [static]

Compares two null-terminated character strings, up to a given number of characters.

template<typename CharPointerType1 , typename CharPointerType2 >
static int CharacterFunctions::compareIgnoreCase ( CharPointerType1  s1,
CharPointerType2  s2 
) [static]

Compares two null-terminated character strings, using a case-independant match.

template<typename CharPointerType1 , typename CharPointerType2 >
static int CharacterFunctions::compareIgnoreCaseUpTo ( CharPointerType1  s1,
CharPointerType2  s2,
int  maxChars 
) [static]

Compares two null-terminated character strings, using a case-independent match.

template<typename CharPointerType1 , typename CharPointerType2 >
static int CharacterFunctions::indexOf ( CharPointerType1  haystack,
const CharPointerType2 &  needle 
) [static]

Finds the character index of a given substring in another string.

Returns -1 if the substring is not found.

template<typename CharPointerType1 , typename CharPointerType2 >
static int CharacterFunctions::indexOfIgnoreCase ( CharPointerType1  haystack,
const CharPointerType2 &  needle 
) [static]

Finds the character index of a given substring in another string, using a case-independent match.

Returns -1 if the substring is not found.

template<typename Type >
static int CharacterFunctions::indexOfChar ( Type  text,
const juce_wchar  charToFind 
) [static]

Finds the character index of a given character in another string.

Returns -1 if the character is not found.

Referenced by CharPointer_UTF32::indexOf(), CharPointer_ASCII::indexOf(), CharPointer_UTF16::indexOf(), and CharPointer_UTF8::indexOf().

template<typename Type >
static int CharacterFunctions::indexOfCharIgnoreCase ( Type  text,
juce_wchar  charToFind 
) [static]

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_UTF32::indexOf(), CharPointer_ASCII::indexOf(), CharPointer_UTF16::indexOf(), and CharPointer_UTF8::indexOf().

template<typename Type >
static Type CharacterFunctions::findEndOfWhitespace ( const Type &  text) [static]

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 readDoubleValue().

template<typename Type >
static Type CharacterFunctions::findEndOfToken ( const Type &  text,
const Type &  breakCharacters,
const Type &  quoteCharacters 
) [static]

Returns a pointer to the first character in the string which is found in the breakCharacters string.


The documentation for this class was generated from the following file: