mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix bug
This commit is contained in:
parent
e267e0ef61
commit
24569b81c8
@ -4239,12 +4239,12 @@ public class CharSequenceUtil {
|
|||||||
return str.charAt(0) + ".." + str.charAt(strLength - 1);
|
return str.charAt(0) + ".." + str.charAt(strLength - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int w2 = (maxLength - 3) / 2;
|
final int suffixLength = (maxLength - 3) / 2;
|
||||||
final int w1 = w2 + (maxLength - 3) % 2; // w2 或 w2 + 1
|
final int preLength = suffixLength + (maxLength - 3) % 2; // suffixLength 或 suffixLength + 1
|
||||||
final String str2 = str.toString();
|
final String str2 = str.toString();
|
||||||
return format("{}...{}",
|
return format("{}...{}",
|
||||||
str2.substring(0, w1),
|
str2.substring(0, preLength),
|
||||||
str2.substring(strLength - w2));
|
str2.substring(strLength - suffixLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user