]> source.dussan.org Git - nextcloud-server.git/commitdiff
provide case-insensitive natural sorting
authorAW-UC <git@a-wesemann.de>
Wed, 18 Feb 2015 14:49:03 +0000 (15:49 +0100)
committerAW-UC <git@a-wesemann.de>
Wed, 18 Feb 2015 14:49:03 +0000 (15:49 +0100)
This makes OC's naturalsort_defaultcollator case-insensitive

lib/private/naturalsort_defaultcollator.php

index e1007f8d7b4d03e042b950eda7ae5d010d23df71..33b99d4ecbbbf808f93a8c21bec0e9a174f45952 100644 (file)
@@ -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;
        }
 }