New string rank function (sort)