Commit 11852664 authored by yanzg's avatar yanzg

修复等待时间

parent e991d17e
......@@ -104,7 +104,8 @@ public class CollectionString {
* @return 字符串的长度
*/
public static int length(String value) {
int valueLength = 0;
int chLength = 0;
int enLength = 0;
String chinese = "[\u0391-\uFFE5]";
/* 获取字段值的长度,如果含中⽂字符,则每个中⽂字符长度为2,否则为1 */
for (int i = 0; i < value.length(); i++) {
......@@ -113,12 +114,12 @@ public class CollectionString {
/* 判断是否为中⽂字符 */
if (temp.matches(chinese)) {
/* 中⽂字符长度为2 */
valueLength += 2;
chLength++;
} else {
/* 其他字符长度为1 */
valueLength += 1;
enLength++;
}
}
return valueLength;
return chLength * 5 / 3 + enLength;
}
}
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