93 String (
const wchar_t* text);
135 String (
const std::string&);
159 #if (JUCE_STRING_UTF_TYPE == 32)
161 #elif (JUCE_STRING_UTF_TYPE == 16)
163 #elif (DOXYGEN || JUCE_STRING_UTF_TYPE == 8)
166 #error "You must set the value of JUCE_STRING_UTF_TYPE to be either 8, 16, or 32!"
211 #if ! JUCE_NATIVE_WCHAR_IS_UTF32
236 template <
class CharPo
inter>
265 template <
class CharPo
inter>
287 template <
class CharPo
inter>
290 appendCharPointer (
textToAppend, std::numeric_limits<size_t>::max());
613 String substring (
int startIndex,
int endIndex)
const;
663 bool ignoreCase)
const;
675 bool ignoreCase)
const;
692 bool ignoreCase)
const;
703 bool ignoreCase)
const;
754 String replaceSection (
int startIndex,
841 bool isQuotedString()
const;
965 explicit String (
double doubleValue);
992 explicit String (
bool) =
delete;
1066 static String toHexString (
const void* data,
int size,
int groupSize = 1);
1073 template <
typename DecimalType>
1095 #if JUCE_PROJUCER_LIVE_BUILD
1097 constexpr int bufferSize = 311;
1098 char buffer[bufferSize];
1099 auto* ptr = &(buffer[0]);
1100 auto*
const safeEnd = ptr + (bufferSize - 1);
1187 std::stringstream
ss;
1188 ss << std::fixed << std::setprecision (std::max (
shift, 0)) <<
rounded;
1226 const char* toRawUTF8()
const;
1263 const wchar_t* toWideCharPointer()
const;
1266 std::string toStdString()
const;
1355 #if JUCE_MAC || JUCE_IOS || DOXYGEN
1391 struct PreallocationBytes
1393 explicit PreallocationBytes (
size_t)
noexcept;
1397 explicit String (
const PreallocationBytes&);
1407 static String formattedRaw (
const char*, ...);
1409 static String createHex (uint8);
1410 static String createHex (uint16);
1411 static String createHex (uint32);
1412 static String createHex (uint64);
1414 template <
typename Type>
1415 static String createHex (Type n) {
return createHex (
static_cast<typename TypeHelpers::UnsignedTypeWithSize<(
int) sizeof (n)
>::type> (n)); }
1420JUCE_API String JUCE_CALLTYPE operator+ (
const char* string1,
const String& string2);
1422JUCE_API String JUCE_CALLTYPE operator+ (
const wchar_t* string1,
const String& string2);
1424JUCE_API String JUCE_CALLTYPE operator+ (
char string1,
const String& string2);
1426JUCE_API String JUCE_CALLTYPE operator+ (
wchar_t string1,
const String& string2);
1427#if ! JUCE_NATIVE_WCHAR_IS_UTF32
1429JUCE_API String JUCE_CALLTYPE operator+ (juce_wchar string1,
const String& string2);
1433JUCE_API String JUCE_CALLTYPE operator+ (String string1,
const String& string2);
1435JUCE_API String JUCE_CALLTYPE operator+ (String string1,
const char* string2);
1437JUCE_API String JUCE_CALLTYPE operator+ (String string1,
const wchar_t* string2);
1439JUCE_API String JUCE_CALLTYPE operator+ (String string1,
const std::string& string2);
1441JUCE_API String JUCE_CALLTYPE operator+ (String string1,
char characterToAppend);
1443JUCE_API String JUCE_CALLTYPE operator+ (String string1,
wchar_t characterToAppend);
1444#if ! JUCE_NATIVE_WCHAR_IS_UTF32
1446JUCE_API String JUCE_CALLTYPE operator+ (String string1, juce_wchar characterToAppend);
1451JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
char characterToAppend);
1453JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
wchar_t characterToAppend);
1454#if ! JUCE_NATIVE_WCHAR_IS_UTF32
1456JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, juce_wchar characterToAppend);
1460JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
const char* string2);
1462JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
const wchar_t* string2);
1464JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
const String& string2);
1466JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, StringRef string2);
1468JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
const std::string& string2);
1471JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, uint8 number);
1473JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
short number);
1475JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
int number);
1477JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
long number);
1479JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
unsigned long number);
1481JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, int64 number);
1483JUCE_API String& JUCE_CALLTYPE operator<< (String& string1, uint64 number);
1485JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
float number);
1487JUCE_API String& JUCE_CALLTYPE operator<< (String& string1,
double number);
1491String& JUCE_CALLTYPE operator<< (String&,
bool) =
delete;
1495JUCE_API bool JUCE_CALLTYPE operator== (
const String& string1,
const String& string2)
noexcept;
1497JUCE_API bool JUCE_CALLTYPE operator== (
const String& string1,
const char* string2)
noexcept;
1499JUCE_API bool JUCE_CALLTYPE operator== (
const String& string1,
const wchar_t* string2)
noexcept;
1501JUCE_API bool JUCE_CALLTYPE operator== (
const String& string1, CharPointer_UTF8 string2)
noexcept;
1503JUCE_API bool JUCE_CALLTYPE operator== (
const String& string1, CharPointer_UTF16 string2)
noexcept;
1505JUCE_API bool JUCE_CALLTYPE operator== (
const String& string1, CharPointer_UTF32 string2)
noexcept;
1508JUCE_API bool JUCE_CALLTYPE operator!= (
const String& string1,
const String& string2)
noexcept;
1510JUCE_API bool JUCE_CALLTYPE operator!= (
const String& string1,
const char* string2)
noexcept;
1512JUCE_API bool JUCE_CALLTYPE operator!= (
const String& string1,
const wchar_t* string2)
noexcept;
1514JUCE_API bool JUCE_CALLTYPE operator!= (
const String& string1, CharPointer_UTF8 string2)
noexcept;
1516JUCE_API bool JUCE_CALLTYPE operator!= (
const String& string1, CharPointer_UTF16 string2)
noexcept;
1518JUCE_API bool JUCE_CALLTYPE operator!= (
const String& string1, CharPointer_UTF32 string2)
noexcept;
1521JUCE_API bool JUCE_CALLTYPE operator> (
const String& string1,
const String& string2)
noexcept;
1523JUCE_API bool JUCE_CALLTYPE operator< (
const String& string1,
const String& string2)
noexcept;
1525JUCE_API bool JUCE_CALLTYPE operator>= (
const String& string1,
const String& string2)
noexcept;
1527JUCE_API bool JUCE_CALLTYPE operator<= (
const String& string1,
const String& string2)
noexcept;
1533template <
class traits>
1534std::basic_ostream <char, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <char, traits>& stream,
const String& stringToWrite)
1536 return stream << stringToWrite.toRawUTF8();
1542template <
class traits>
1543std::basic_ostream <wchar_t, traits>& JUCE_CALLTYPE operator<< (std::basic_ostream <wchar_t, traits>& stream,
const String& stringToWrite)
1545 return stream << stringToWrite.toWideCharPointer();
1549JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream,
const String& stringToWrite);
1552JUCE_API OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, StringRef stringToWrite);
1559 template <>
struct hash<juce::String>
1561 size_t operator() (
const juce::String& s)
const noexcept {
return s.hash(); }
Holds a resizable array of primitive or copy-by-value objects.
bool isEmpty() const noexcept
Returns true if the array is empty, false otherwise.
Wraps a pointer to a null-terminated ASCII character string, and provides various methods to operate ...
Wraps a pointer to a null-terminated UTF-16 character string, and provides various methods to operate...
Wraps a pointer to a null-terminated UTF-32 character string, and provides various methods to operate...
Wraps a pointer to a null-terminated UTF-8 character string, and provides various methods to operate ...
void writeWithCharLimit(const CharPointer src, const int maxChars) noexcept
Copies a source string to this pointer, advancing this pointer as it goes.
A simple class for holding temporary references to a string literal or String.
CharPointerType getCharPointer() const noexcept
Returns the character pointer currently being used to store this string.
bool isEmpty() const noexcept
Returns true if the string contains no characters.
static String toDecimalStringWithSignificantFigures(DecimalType number, int numberOfSignificantFigures)
Returns a string containing a decimal with a set number of significant figures.
void appendCharPointer(CharPointer startOfTextToAppend, CharPointer endOfTextToAppend)
Appends a string to the end of this one.
void appendCharPointer(CharPointer textToAppend, size_t maxCharsToTake)
Appends a string to the end of this one.
void appendCharPointer(CharPointer textToAppend)
Appends a string to the end of this one.
CFStringRef toCFString() const
OSX ONLY - Converts this string to a CFString.
String convertToPrecomposedUnicode() const
OSX ONLY - Returns a copy of this string in which any decomposed unicode characters have been convert...
static String fromCFString(CFStringRef cfString)
OSX ONLY - Creates a String from an OSX CFString.
bool isNotEmpty() const noexcept
Returns true if the string contains at least one character.
#define JUCE_API
This macro is added to all JUCE public class declarations.