diff --git a/source/Ox/js/Array.js b/source/Ox/js/Array.js index ec21a84d..41b6ce86 100644 --- a/source/Ox/js/Array.js +++ b/source/Ox/js/Array.js @@ -625,10 +625,11 @@ Ox.range = function() { return false; // break } }); - // pad numbers - sortValue = sortValue.replace(/\d+/g, function(match) { - return Ox.pad(match, 'left', 64, '0'); - }); + // remove thousand separators and pad numbers + sortValue = sortValue.replace(/(\d),(?=(\d{3}))/g, '$1') + .replace(/\d+/g, function(match) { + return Ox.pad(match, 'left', 64, '0'); + }); } return sortValue; }, {key: function(args) { @@ -647,6 +648,8 @@ Ox.range = function() { [{id: 1, name: '8 Women'}, {id: 0, name: '80 Days'}] > Ox.sort(['In 80 Days Around the World', 'In 9 Minutes Around the World']) ['In 9 Minutes Around the World', 'In 80 Days Around the World'] + > Ox.sort(['80 Days', '20,000 Leagues']) + ['80 Days', '20,000 Leagues'] > Ox.sort(['Man', 'A Plan', 'The Canal']) ['The Canal', 'Man', 'A Plan'] > Ox.sort(['The 9', 'The 10', 'An A', 'A "B"'])