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

Refactored some directory iteration code and other minor clean-ups.

This commit is contained in:
Julian Storer 2010-04-25 15:14:32 +01:00
parent 5bbe222266
commit a7e824032f
37 changed files with 1692 additions and 2016 deletions

View file

@ -1542,10 +1542,7 @@ const String String::trimCharactersAtStart (const String& charactersToTrim) cons
while (charactersToTrim.containsChar (*t))
++t;
if (t == text)
return *this;
return String (t);
return t == text ? *this : String (t);
}
const String String::trimCharactersAtEnd (const String& charactersToTrim) const
@ -1553,12 +1550,17 @@ const String String::trimCharactersAtEnd (const String& charactersToTrim) const
if (isEmpty())
return empty;
const juce_wchar* endT = text + (length() - 1);
const int len = length();
const juce_wchar* endT = text + (len - 1);
int numToRemove = 0;
while (endT >= text && charactersToTrim.containsChar (*endT))
while (numToRemove < len && charactersToTrim.containsChar (*endT))
{
++numToRemove;
--endT;
}
return String (text, (int) (++endT - text));
return numToRemove > 0 ? String (text, len - numToRemove) : *this;
}
//==============================================================================