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:
parent
9c8afb5b48
commit
3b88555140
9 changed files with 131 additions and 43 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue