2 * Copyright 2009, Dana Burkart
3 * Copyright 2009, Stephan Aßmus <superstippi@gmx.de>
4 * Copyright 2010, Axel Dörfler, axeld@pinc-software.de
5 * Copyright 2010, Rene Gollent (anevilyak@gmail.com)
6 * Distributed under the terms of the MIT License.
10 #include <NaturalCompare.h>
23 // #pragma mark - Natural sorting
26 //! Compares two strings naturally, as opposed to lexicographically
28 NaturalCompare(const char* stringA
, const char* stringB
)
30 static BCollator
* collator
= NULL
;
34 collator
= new BCollator();
35 BLocale::Default()->GetCollator(collator
);
36 collator
->SetStrength(B_COLLATE_SECONDARY
);
37 collator
->SetNumericSorting(true);
40 return collator
->Compare(stringA
, stringB
);
44 } // namespace BPrivate