1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

Optimised performance of String::isEmpty()

This commit is contained in:
jules 2015-03-27 09:24:30 +00:00
parent c240ca4eaf
commit c66f412224
2 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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;