1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Replaced the old, badly-named and badly-implemented String::compareLexicographically() method with String::compareNatural(), which uses a smarter algorithm. Also added a method StringArray::sortNatural() which uses this.

This commit is contained in:
jules 2014-06-15 10:37:31 +01:00
parent 9c8afb5b48
commit 3b88555140
9 changed files with 131 additions and 43 deletions

View file

@ -743,7 +743,7 @@ struct ItemSorter
{
static int compareElements (const ValueTree& first, const ValueTree& second)
{
return first [Ids::name].toString().compareIgnoreCase (second [Ids::name].toString());
return first [Ids::name].toString().compareNatural (second [Ids::name].toString());
}
};
@ -755,7 +755,7 @@ struct ItemSorterWithGroupsAtStart
const bool secondIsGroup = second.hasType (Ids::GROUP);
if (firstIsGroup == secondIsGroup)
return first [Ids::name].toString().compareIgnoreCase (second [Ids::name].toString());
return first [Ids::name].toString().compareNatural (second [Ids::name].toString());
return firstIsGroup ? -1 : 1;
}