mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
fix comment
This commit is contained in:
parent
c4ce66a991
commit
b228fe0153
@ -3,12 +3,13 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 5.5.8 (2021-01-19)
|
||||
# 5.5.8 (2021-01-20)
|
||||
|
||||
### 新特性
|
||||
* 【extra 】 增加自动装配SpringUtil类(pr#1366@Github)
|
||||
* 【extra 】 ArrayUtil增加map方法重载
|
||||
* 【crypto 】 AsymmetricAlgorithm增加RSA_ECB("RSA/ECB/NoPadding")(issue#1368@Github)
|
||||
* 【core 】 补充StrUtil.padXXX注释(issue#I2E1S7@Gitee)
|
||||
|
||||
### Bug修复
|
||||
* 【core 】 修复FileUtil.move以及PathUtil.copy等无法自动创建父目录的问题(issue#I2CKTI@Gitee)
|
||||
|
@ -2937,7 +2937,7 @@ public class CharSequenceUtil {
|
||||
// ------------------------------------------------------------------------ pad
|
||||
|
||||
/**
|
||||
* 补充字符串以满足最小长度
|
||||
* 补充字符串以满足指定长度,如果提供的字符串大于指定长度,截断之
|
||||
*
|
||||
* <pre>
|
||||
* StrUtil.padPre(null, *, *);//null
|
||||
@ -2946,26 +2946,27 @@ public class CharSequenceUtil {
|
||||
* </pre>
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param minLength 最小长度
|
||||
* @param length 长度
|
||||
* @param padStr 补充的字符
|
||||
* @return 补充后的字符串
|
||||
*/
|
||||
public static String padPre(CharSequence str, int minLength, CharSequence padStr) {
|
||||
public static String padPre(CharSequence str, int length, CharSequence padStr) {
|
||||
if (null == str) {
|
||||
return null;
|
||||
}
|
||||
final int strLen = str.length();
|
||||
if (strLen == minLength) {
|
||||
if (strLen == length) {
|
||||
return str.toString();
|
||||
} else if (strLen > minLength) {
|
||||
return subPre(str, minLength);
|
||||
} else if (strLen > length) {
|
||||
//如果提供的字符串大于指定长度,截断之
|
||||
return subPre(str, length);
|
||||
}
|
||||
|
||||
return repeatByLength(padStr, minLength - strLen).concat(str.toString());
|
||||
return repeatByLength(padStr, length - strLen).concat(str.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 补充字符串以满足最小长度
|
||||
* 补充字符串以满足最小长度,如果提供的字符串大于指定长度,截断之
|
||||
*
|
||||
* <pre>
|
||||
* StrUtil.padPre(null, *, *);//null
|
||||
@ -2974,26 +2975,27 @@ public class CharSequenceUtil {
|
||||
* </pre>
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param minLength 最小长度
|
||||
* @param length 长度
|
||||
* @param padChar 补充的字符
|
||||
* @return 补充后的字符串
|
||||
*/
|
||||
public static String padPre(CharSequence str, int minLength, char padChar) {
|
||||
public static String padPre(CharSequence str, int length, char padChar) {
|
||||
if (null == str) {
|
||||
return null;
|
||||
}
|
||||
final int strLen = str.length();
|
||||
if (strLen == minLength) {
|
||||
if (strLen == length) {
|
||||
return str.toString();
|
||||
} else if (strLen > minLength) {
|
||||
return subPre(str, minLength);
|
||||
} else if (strLen > length) {
|
||||
//如果提供的字符串大于指定长度,截断之
|
||||
return subPre(str, length);
|
||||
}
|
||||
|
||||
return repeat(padChar, minLength - strLen).concat(str.toString());
|
||||
return repeat(padChar, length - strLen).concat(str.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 补充字符串以满足最小长度
|
||||
* 补充字符串以满足最小长度,如果提供的字符串大于指定长度,截断之
|
||||
*
|
||||
* <pre>
|
||||
* StrUtil.padAfter(null, *, *);//null
|
||||
@ -3002,22 +3004,23 @@ public class CharSequenceUtil {
|
||||
* </pre>
|
||||
*
|
||||
* @param str 字符串,如果为{@code null},直接返回null
|
||||
* @param minLength 最小长度
|
||||
* @param length 长度
|
||||
* @param padChar 补充的字符
|
||||
* @return 补充后的字符串
|
||||
*/
|
||||
public static String padAfter(CharSequence str, int minLength, char padChar) {
|
||||
public static String padAfter(CharSequence str, int length, char padChar) {
|
||||
if (null == str) {
|
||||
return null;
|
||||
}
|
||||
final int strLen = str.length();
|
||||
if (strLen == minLength) {
|
||||
if (strLen == length) {
|
||||
return str.toString();
|
||||
} else if (strLen > minLength) {
|
||||
return sub(str, strLen - minLength, strLen);
|
||||
} else if (strLen > length) {
|
||||
//如果提供的字符串大于指定长度,截断之
|
||||
return sub(str, strLen - length, strLen);
|
||||
}
|
||||
|
||||
return str.toString().concat(repeat(padChar, minLength - strLen));
|
||||
return str.toString().concat(repeat(padChar, length - strLen));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3030,23 +3033,24 @@ public class CharSequenceUtil {
|
||||
* </pre>
|
||||
*
|
||||
* @param str 字符串,如果为{@code null},直接返回null
|
||||
* @param minLength 最小长度
|
||||
* @param length 长度
|
||||
* @param padStr 补充的字符
|
||||
* @return 补充后的字符串
|
||||
* @since 4.3.2
|
||||
*/
|
||||
public static String padAfter(CharSequence str, int minLength, CharSequence padStr) {
|
||||
public static String padAfter(CharSequence str, int length, CharSequence padStr) {
|
||||
if (null == str) {
|
||||
return null;
|
||||
}
|
||||
final int strLen = str.length();
|
||||
if (strLen == minLength) {
|
||||
if (strLen == length) {
|
||||
return str.toString();
|
||||
} else if (strLen > minLength) {
|
||||
return subSufByLength(str, minLength);
|
||||
} else if (strLen > length) {
|
||||
//如果提供的字符串大于指定长度,截断之
|
||||
return subSufByLength(str, length);
|
||||
}
|
||||
|
||||
return str.toString().concat(repeatByLength(padStr, minLength - strLen));
|
||||
return str.toString().concat(repeatByLength(padStr, length - strLen));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------ center
|
||||
|
Loading…
Reference in New Issue
Block a user