summaryrefslogtreecommitdiffstats
path: root/lib/public/util.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-09-16 17:29:03 +0200
committerLukas Reschke <lukas@owncloud.com>2014-09-16 17:29:03 +0200
commitd2743e6ad66ba6827a0e49487ed83667671895c8 (patch)
tree1d50bf0f5364779e3f9e407a126d5694e69f4f00 /lib/public/util.php
parent4669ea38357f3f33caaf056d859e6318b75b72e1 (diff)
parentf2001a48a4e91bc6427a2a63ba9022ceaf1d305d (diff)
downloadnextcloud-server-d2743e6ad66ba6827a0e49487ed83667671895c8.tar.gz
nextcloud-server-d2743e6ad66ba6827a0e49487ed83667671895c8.zip
Merge pull request #7254 from owncloud/core-sortalgo
Fixed JS sort comparator to be consistent between JS and PHP
Diffstat (limited to 'lib/public/util.php')
-rw-r--r--lib/public/util.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/public/util.php b/lib/public/util.php
index 2f657facfe8..244c11ba2cc 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -512,6 +512,17 @@ class Util {
}
/**
+ * Compare two strings to provide a natural sort
+ * @param $a first string to compare
+ * @param $b second string to compare
+ * @return -1 if $b comes before $a, 1 if $a comes before $b
+ * or 0 if the strings are identical
+ */
+ public static function naturalSortCompare($a, $b) {
+ return \OC\NaturalSort::getInstance()->compare($a, $b);
+ }
+
+ /**
* check if a password is required for each public link
* @return boolean
*/