summaryrefslogtreecommitdiffstats
path: root/lib/private/naturalsort_defaultcollator.php
diff options
context:
space:
mode:
authorAW-UC <git@a-wesemann.de>2015-02-18 15:49:03 +0100
committerAW-UC <git@a-wesemann.de>2015-02-18 15:49:03 +0100
commit097d455213ff3134fbbf9689a4c1e739719b4c1e (patch)
tree09afe2254a523b0470ece2ed70a82e5dbf8e53e8 /lib/private/naturalsort_defaultcollator.php
parentd665b7a4b1def34799fc386333f42497cb3aaeca (diff)
downloadnextcloud-server-097d455213ff3134fbbf9689a4c1e739719b4c1e.tar.gz
nextcloud-server-097d455213ff3134fbbf9689a4c1e739719b4c1e.zip
provide case-insensitive natural sorting
This makes OC's naturalsort_defaultcollator case-insensitive
Diffstat (limited to 'lib/private/naturalsort_defaultcollator.php')
-rw-r--r--lib/private/naturalsort_defaultcollator.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/private/naturalsort_defaultcollator.php b/lib/private/naturalsort_defaultcollator.php
index e1007f8d7b4..33b99d4ecbb 100644
--- a/lib/private/naturalsort_defaultcollator.php
+++ b/lib/private/naturalsort_defaultcollator.php
@@ -11,9 +11,10 @@ namespace OC;
class NaturalSort_DefaultCollator {
public function compare($a, $b) {
- if ($a === $b) {
- return 0;
- }
- return ($a < $b) ? -1 : 1;
+ $result = strcasecmp($a, $b);
+ if ($result === 0) {
+ return 0;
+ }
+ return ($result < 0) ? -1 : 1;
}
}