diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index 2cca258027..f91adf5098 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -1617,10 +1617,10 @@ String String::upToLastOccurrenceOf (StringRef sub, bool String::isQuotedString() const { - const String trimmed (trimStart()); + const juce_wchar trimmedStart = trimStart()[0]; - return trimmed[0] == '"' - || trimmed[0] == '\''; + return trimmedStart == '"' + || trimmedStart == '\''; } String String::unquoted() const diff --git a/modules/juce_core/text/juce_String.h b/modules/juce_core/text/juce_String.h index 0260acff13..8fb209adb6 100644 --- a/modules/juce_core/text/juce_String.h +++ b/modules/juce_core/text/juce_String.h @@ -299,13 +299,13 @@ public: Note that there's also an isNotEmpty() method to help write readable code. @see containsNonWhitespaceChars() */ - inline bool isEmpty() const noexcept { return text[0] == 0; } + inline bool isEmpty() const noexcept { return text.isEmpty(); } /** Returns true if the string contains at least one character. Note that there's also an isEmpty() method to help write readable code. @see containsNonWhitespaceChars() */ - inline bool isNotEmpty() const noexcept { return text[0] != 0; } + inline bool isNotEmpty() const noexcept { return ! text.isEmpty(); } /** Resets this string to be empty. */ void clear() noexcept;