OpenShot Library | OpenShotAudio 0.2.2
juce::CharacterFunctions Class Reference

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. More...
 
static juce_wchar toLowerCase (juce_wchar character) noexcept
 Converts a character to lower-case. More...
 
static bool isUpperCase (juce_wchar character) noexcept
 Checks whether a unicode character is upper-case. More...
 
static bool isLowerCase (juce_wchar character) noexcept
 Checks whether a unicode character is lower-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...
 
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 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 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...
 
static juce_wchar getUnicodeCharFromWindows1252Codepage (uint8 windows1252Char) noexcept
 Converts a byte of Windows 1252 codepage to unicode. More...
 
template<typename CharPointerType >
static double readDoubleValue (CharPointerType &text) noexcept
 Parses a character string to read a floating-point number. More...
 
template<typename CharPointerType >
static double getDoubleValue (CharPointerType text) noexcept
 Parses a character string, to read a floating-point value. More...
 
template<typename IntType , typename CharPointerType >
static IntType getIntValue (const CharPointerType text) noexcept
 Parses a character string, to read an integer value. 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 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 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 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...
 
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...
 
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...
 
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 indexOf (CharPointerType1 textToSearch, const CharPointerType2 substringToLookFor) noexcept
 Finds the character index of a given substring in another string. 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 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...
 
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 Type >
static Type findEndOfWhitespace (Type text) noexcept
 Returns a pointer to the first non-whitespace character 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...
 

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

Definition at line 95 of file juce_CharacterFunctions.h.

Member Function Documentation

◆ toUpperCase()

juce_wchar juce::CharacterFunctions::toUpperCase ( juce_wchar  character)
staticnoexcept

◆ toLowerCase()

juce_wchar juce::CharacterFunctions::toLowerCase ( juce_wchar  character)
staticnoexcept

◆ isUpperCase()

bool juce::CharacterFunctions::isUpperCase ( juce_wchar  character)
staticnoexcept

◆ isLowerCase()

bool juce::CharacterFunctions::isLowerCase ( juce_wchar  character)
staticnoexcept

◆ isWhitespace() [1/2]

bool juce::CharacterFunctions::isWhitespace ( char  character)
staticnoexcept

◆ isWhitespace() [2/2]

bool juce::CharacterFunctions::isWhitespace ( juce_wchar  character)
staticnoexcept

Checks whether a character is whitespace.

Definition at line 69 of file juce_CharacterFunctions.cpp.

◆ isDigit() [1/2]

bool juce::CharacterFunctions::isDigit ( char  character)
staticnoexcept

◆ isDigit() [2/2]

bool juce::CharacterFunctions::isDigit ( juce_wchar  character)
staticnoexcept

Checks whether a character is a digit.

Definition at line 79 of file juce_CharacterFunctions.cpp.

◆ isLetter() [1/2]

bool juce::CharacterFunctions::isLetter ( char  character)
staticnoexcept

◆ isLetter() [2/2]

bool juce::CharacterFunctions::isLetter ( juce_wchar  character)
staticnoexcept

Checks whether a character is alphabetic.

Definition at line 90 of file juce_CharacterFunctions.cpp.

◆ isLetterOrDigit() [1/2]

bool juce::CharacterFunctions::isLetterOrDigit ( char  character)
staticnoexcept

◆ isLetterOrDigit() [2/2]

bool juce::CharacterFunctions::isLetterOrDigit ( juce_wchar  character)
staticnoexcept

Checks whether a character is alphabetic or numeric.

Definition at line 102 of file juce_CharacterFunctions.cpp.

◆ isPrintable() [1/2]

bool juce::CharacterFunctions::isPrintable ( char  character)
staticnoexcept

Checks whether a character is a printable character, i.e.

alphabetic, numeric, a punctuation character or a space.

Definition at line 107 of file juce_CharacterFunctions.cpp.

◆ isPrintable() [2/2]

bool juce::CharacterFunctions::isPrintable ( juce_wchar  character)
staticnoexcept

Checks whether a character is a printable character, i.e.

alphabetic, numeric, a punctuation character or a space.

Definition at line 112 of file juce_CharacterFunctions.cpp.

◆ getHexDigitValue()

int juce::CharacterFunctions::getHexDigitValue ( juce_wchar  digit)
staticnoexcept

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

Definition at line 117 of file juce_CharacterFunctions.cpp.

Referenced by juce::BigInteger::parseString(), and juce::URL::removeEscapeChars().

◆ getUnicodeCharFromWindows1252Codepage()

juce_wchar juce::CharacterFunctions::getUnicodeCharFromWindows1252Codepage ( uint8  windows1252Char)
staticnoexcept

Converts a byte of Windows 1252 codepage to unicode.

Definition at line 169 of file juce_CharacterFunctions.cpp.

◆ readDoubleValue()

template<typename CharPointerType >
static double juce::CharacterFunctions::readDoubleValue ( CharPointerType &  text)
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.

Definition at line 151 of file juce_CharacterFunctions.h.

◆ getDoubleValue()

template<typename CharPointerType >
static double juce::CharacterFunctions::getDoubleValue ( CharPointerType  text)
inlinestaticnoexcept

◆ getIntValue()

template<typename IntType , typename CharPointerType >
static IntType juce::CharacterFunctions::getIntValue ( const CharPointerType  text)
inlinestaticnoexcept

Parses a character string, to read an integer value.

Definition at line 423 of file juce_CharacterFunctions.h.

◆ lengthUpTo() [1/2]

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

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

Definition at line 472 of file juce_CharacterFunctions.h.

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

◆ lengthUpTo() [2/2]

template<typename CharPointerType >
static size_t juce::CharacterFunctions::lengthUpTo ( CharPointerType  start,
const CharPointerType  end 
)
inlinestaticnoexcept

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

Definition at line 485 of file juce_CharacterFunctions.h.

◆ copyAll()

template<typename DestCharPointerType , typename SrcCharPointerType >
static void juce::CharacterFunctions::copyAll ( DestCharPointerType &  dest,
SrcCharPointerType  src 
)
inlinestaticnoexcept

Copies null-terminated characters from one string to another.

Definition at line 497 of file juce_CharacterFunctions.h.

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

◆ copyWithDestByteLimit()

template<typename DestCharPointerType , typename SrcCharPointerType >
static size_t juce::CharacterFunctions::copyWithDestByteLimit ( DestCharPointerType &  dest,
SrcCharPointerType  src,
size_t  maxBytesToWrite 
)
inlinestaticnoexcept

Copies characters from one string to another, up to a null terminator or a given byte size limit.

Definition at line 508 of file juce_CharacterFunctions.h.

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

◆ copyWithCharLimit()

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

Copies characters from one string to another, up to a null terminator or a given maximum number of characters.

Definition at line 535 of file juce_CharacterFunctions.h.

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

◆ compare() [1/2]

static int juce::CharacterFunctions::compare ( juce_wchar  char1,
juce_wchar  char2 
)
inlinestaticnoexcept

◆ compare() [2/2]

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

Compares two null-terminated character strings.

Definition at line 561 of file juce_CharacterFunctions.h.

◆ compareUpTo()

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

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

Definition at line 579 of file juce_CharacterFunctions.h.

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

◆ compareIgnoreCase() [1/2]

static int juce::CharacterFunctions::compareIgnoreCase ( juce_wchar  char1,
juce_wchar  char2 
)
inlinestaticnoexcept

◆ compareIgnoreCase() [2/2]

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

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

Definition at line 603 of file juce_CharacterFunctions.h.

◆ compareIgnoreCaseUpTo()

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

◆ indexOf()

template<typename CharPointerType1 , typename CharPointerType2 >
static int juce::CharacterFunctions::indexOf ( CharPointerType1  textToSearch,
const CharPointerType2  substringToLookFor 
)
inlinestaticnoexcept

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

Returns -1 if the substring is not found.

Definition at line 641 of file juce_CharacterFunctions.h.

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

◆ find() [1/2]

template<typename CharPointerType1 , typename CharPointerType2 >
static CharPointerType1 juce::CharacterFunctions::find ( CharPointerType1  textToSearch,
const CharPointerType2  substringToLookFor 
)
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.

Definition at line 663 of file juce_CharacterFunctions.h.

Referenced by juce::MemoryBlock::fromBase64Encoding().

◆ find() [2/2]

template<typename CharPointerType >
static CharPointerType juce::CharacterFunctions::find ( CharPointerType  textToSearch,
const juce_wchar  charToLookFor 
)
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.

Definition at line 679 of file juce_CharacterFunctions.h.

◆ indexOfIgnoreCase()

template<typename CharPointerType1 , typename CharPointerType2 >
static int juce::CharacterFunctions::indexOfIgnoreCase ( CharPointerType1  haystack,
const CharPointerType2  needle 
)
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.

Definition at line 697 of file juce_CharacterFunctions.h.

Referenced by juce::String::indexOfIgnoreCase().

◆ indexOfChar()

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

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

Returns -1 if the character is not found.

Definition at line 718 of file juce_CharacterFunctions.h.

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

◆ indexOfCharIgnoreCase()

template<typename Type >
static int juce::CharacterFunctions::indexOfCharIgnoreCase ( Type  text,
juce_wchar  charToFind 
)
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.

Definition at line 738 of file juce_CharacterFunctions.h.

References toLowerCase().

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

◆ findEndOfWhitespace()

template<typename Type >
static Type juce::CharacterFunctions::findEndOfWhitespace ( Type  text)
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.

Definition at line 760 of file juce_CharacterFunctions.h.

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

◆ findEndOfToken()

template<typename Type , typename BreakType >
static Type juce::CharacterFunctions::findEndOfToken ( Type  text,
BreakType  breakCharacters,
Type  quoteCharacters 
)
inlinestatic

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

Definition at line 772 of file juce_CharacterFunctions.h.

Referenced by juce::StringArray::addTokens().


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