Commit 064f5829 by 高鹏

Merge branch 'hzk' into 'master'

修改比较器

See merge request rays/pcloud-common-parent!17
parents 82d309d4 6f031eaa
......@@ -306,4 +306,6 @@ public class ProductTypeConstant {
* 作品下资源来源于content中心的作品
*/
public static final String[] RESOURCE_CONTENT_PRODUCT = {AUDIO, VIDEO, BOOK, LISTEN, PDF, ALBUM, FORMAT, EBOOK};
}
package com.pcloud.common.utils.string;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.util.Comparator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -54,8 +55,8 @@ public class StringComparator implements Comparator<String> {
boolean isCh1Num = ch1 >= '0' && ch1 <= '9';
boolean isCh2Num = ch2 >= '0' && ch2 <= '9';
if (isCh1Num && isCh2Num) {
long i1 = getNumber(str1.substring(i,i+1));
long i2 = getNumber(str2.substring(i,i+1));
long i1 = getNumber(str1.substring(i));
long i2 = getNumber(str2.substring(i));
if (i1 != i2) {
return i1 > i2 ? 1 : -1;
}
......@@ -101,9 +102,10 @@ public class StringComparator implements Comparator<String> {
break;
}
}
if (bits > 0) {
if (bits > 0 && bits <19) {
num = Long.parseLong(str.substring(0, bits));
}
return num;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment