Looly 5 年 前
コミット
1873b76017
2 ファイル変更4 行追加70 行削除
  1. 2 1
      CHANGELOG.md
  2. 2 69
      hutool-core/src/main/java/cn/hutool/core/util/StrUtil.java

+ 2 - 1
CHANGELOG.md

@@ -3,7 +3,7 @@
 
 -------------------------------------------------------------------------------------------------------------
 
-# 5.4.5 (2020-10-11)
+# 5.4.5 (2020-10-14)
 
 ### 新特性
 * 【core   】     ConsoleTable代码优化(pr#190@Gitee)
@@ -15,6 +15,7 @@
 * 【core   】     简化CreditCode逻辑去除无用Character.toUpperCase(pr#1145@Github)
 * 【core   】     NumberUtil增加generateRandomNumber重载,可自定义seed(issue#I1XTUT@Gitee)
 * 【core   】     DataSizeUtil支持小数(pr#1158@Github)
+* 【core   】     完善注释(pr#193@Gitee)
 
 ### Bug修复
 * 【core   】     解决农历判断节日未判断大小月导致的问题(issue#I1XHSF@Gitee)

+ 2 - 69
hutool-core/src/main/java/cn/hutool/core/util/StrUtil.java

@@ -29,7 +29,6 @@ import java.util.regex.Pattern;
  * 字符串工具类
  *
  * @author xiaoleilu
- * @since 1.0.0
  */
 public class StrUtil {
 
@@ -123,8 +122,6 @@ public class StrUtil {
 
 	/**
 	 * 字符串常量:点 {@code "."}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String DOT = ".";
 
@@ -136,8 +133,6 @@ public class StrUtil {
 
 	/**
 	 * 字符串常量:斜杠 {@code "/"}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String SLASH = "/";
 
@@ -148,8 +143,6 @@ public class StrUtil {
 
 	/**
 	 * 字符串常量:空字符串 {@code ""}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String EMPTY = "";
 
@@ -167,16 +160,12 @@ public class StrUtil {
 
 	/**
 	 * 字符串常量:换行符 {@code "\n"}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String LF = "\n";
 
 	/**
 	 * 字符串常量:Windows 换行 {@code "\r\n"} <br />
 	 * 解释:该字符串常用于表示 Windows 系统下的文本换行
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String CRLF = "\r\n";
 
@@ -228,22 +217,16 @@ public class StrUtil {
 
 	/**
 	 * 字符串常量:HTML 空格转义 {@code "&nbsp;" -> " "}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String HTML_NBSP = "&nbsp;";
 
 	/**
 	 * 字符串常量:HTML And 符转义 {@code "&amp;" -> "&"}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String HTML_AMP = "&amp;";
 
 	/**
 	 * 字符串常量:HTML 双引号转义 {@code "&quot;" -> "\""}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String HTML_QUOTE = "&quot;";
 
@@ -254,27 +237,20 @@ public class StrUtil {
 
 	/**
 	 * 字符串常量:HTML 小于号转义 {@code "&lt;" -> "<"}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String HTML_LT = "&lt;";
 
 	/**
 	 * 字符串常量:HTML 大于号转义 {@code "&gt;" -> ">"}
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String HTML_GT = "&gt;";
 
 	/**
 	 * 字符串常量:空 JSON <code>"{}"</code>
-	 *
-	 * @since 1.0.0
 	 */
 	public static final String EMPTY_JSON = "{}";
 
 
-
 	// ------------------------------------------------------------------------ Blank
 
 	/**
@@ -305,9 +281,7 @@ public class StrUtil {
 	 *
 	 * @param str 被检测的字符串
 	 * @return 若为空白,则返回 true
-	 *
 	 * @see #isEmpty(CharSequence)
-	 * @since 1.0.0
 	 */
 	public static boolean isBlank(CharSequence str) {
 		int length;
@@ -381,8 +355,7 @@ public class StrUtil {
 	 *
 	 * @param str 被检测的字符串
 	 * @return 是否为非空
-	 *
-	 * @see   StrUtil#isBlank(CharSequence)
+	 * @see StrUtil#isBlank(CharSequence)
 	 */
 	public static boolean isNotBlank(CharSequence str) {
 		return false == isBlank(str);
@@ -484,9 +457,7 @@ public class StrUtil {
 	 *
 	 * @param str 被检测的字符串
 	 * @return 是否为空
-	 *
 	 * @see #isBlank(CharSequence)
-	 * @since 1.0.0
 	 */
 	public static boolean isEmpty(CharSequence str) {
 		return str == null || str.length() == 0;
@@ -542,8 +513,7 @@ public class StrUtil {
 	 *
 	 * @param str 被检测的字符串
 	 * @return 是否为非空
-	 *
-	 * @see   StrUtil#isEmpty(CharSequence)
+	 * @see StrUtil#isEmpty(CharSequence)
 	 */
 	public static boolean isNotEmpty(CharSequence str) {
 		return false == isEmpty(str);
@@ -554,7 +524,6 @@ public class StrUtil {
 	 *
 	 * @param str 被检查的字符串
 	 * @return 原字符串或者空串
-	 *
 	 * @see #nullToEmpty(CharSequence)
 	 * @since 4.6.3
 	 */
@@ -1342,8 +1311,6 @@ public class StrUtil {
 	 *
 	 * @param getOrSetMethodName Get或Set方法名
 	 * @return 如果是set或get方法名,返回field, 否则null
-	 *
-	 * @since 1.0.0
 	 */
 	public static String getGeneralField(CharSequence getOrSetMethodName) {
 		final String getOrSetMethodNameStr = getOrSetMethodName.toString();
@@ -1361,8 +1328,6 @@ public class StrUtil {
 	 *
 	 * @param fieldName 属性名
 	 * @return setXxx
-	 *
-	 * @since 1.0.0
 	 */
 	public static String genSetter(CharSequence fieldName) {
 		return upperFirstAndAddPre(fieldName, "set");
@@ -1373,8 +1338,6 @@ public class StrUtil {
 	 *
 	 * @param fieldName 属性名
 	 * @return getXxx
-	 *
-	 * @since 1.0.0
 	 */
 	public static String genGetter(CharSequence fieldName) {
 		return upperFirstAndAddPre(fieldName, "get");
@@ -1499,8 +1462,6 @@ public class StrUtil {
 	 * @param str       被处理的字符串
 	 * @param preString 添加的首部
 	 * @return 处理后的字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String upperFirstAndAddPre(CharSequence str, String preString) {
 		if (str == null || preString == null) {
@@ -1515,8 +1476,6 @@ public class StrUtil {
 	 *
 	 * @param str 字符串
 	 * @return 字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String upperFirst(CharSequence str) {
 		if (null == str) {
@@ -1537,8 +1496,6 @@ public class StrUtil {
 	 *
 	 * @param str 字符串
 	 * @return 字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String lowerFirst(CharSequence str) {
 		if (null == str) {
@@ -1559,8 +1516,6 @@ public class StrUtil {
 	 * @param str    字符串
 	 * @param prefix 前缀
 	 * @return 切掉后的字符串,若前缀不是 preffix, 返回原字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String removePrefix(CharSequence str, CharSequence prefix) {
 		if (isEmpty(str) || isEmpty(prefix)) {
@@ -1580,8 +1535,6 @@ public class StrUtil {
 	 * @param str    字符串
 	 * @param prefix 前缀
 	 * @return 切掉后的字符串,若前缀不是 prefix, 返回原字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String removePrefixIgnoreCase(CharSequence str, CharSequence prefix) {
 		if (isEmpty(str) || isEmpty(prefix)) {
@@ -1601,8 +1554,6 @@ public class StrUtil {
 	 * @param str    字符串
 	 * @param suffix 后缀
 	 * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String removeSuffix(CharSequence str, CharSequence suffix) {
 		if (isEmpty(str) || isEmpty(suffix)) {
@@ -1633,8 +1584,6 @@ public class StrUtil {
 	 * @param str    字符串
 	 * @param suffix 后缀
 	 * @return 切掉后的字符串,若后缀不是 suffix, 返回原字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String removeSuffixIgnoreCase(CharSequence str, CharSequence suffix) {
 		if (isEmpty(str) || isEmpty(suffix)) {
@@ -1775,8 +1724,6 @@ public class StrUtil {
 	 *
 	 * @param str 被清理的字符串
 	 * @return 清理后的字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String cleanBlank(CharSequence str) {
 		return filter(str, c -> false == CharUtil.isBlankChar(c));
@@ -1851,8 +1798,6 @@ public class StrUtil {
 	 * @param str       被切分的字符串
 	 * @param separator 分隔符字符
 	 * @return 切分后的集合
-	 *
-	 * @since 1.0.0
 	 */
 	public static List<String> split(CharSequence str, char separator) {
 		return split(str, separator, 0);
@@ -1880,8 +1825,6 @@ public class StrUtil {
 	 * @param separator 分隔符字符
 	 * @param limit     限制分片数,-1不限制
 	 * @return 切分后的集合
-	 *
-	 * @since 1.0.0
 	 */
 	public static List<String> split(CharSequence str, char separator, int limit) {
 		return split(str, separator, limit, false, false);
@@ -1994,8 +1937,6 @@ public class StrUtil {
 	 * @param str       被切分的字符串
 	 * @param separator 分隔符
 	 * @return 字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String[] split(CharSequence str, CharSequence separator) {
 		if (str == null) {
@@ -2034,8 +1975,6 @@ public class StrUtil {
 	 * @param fromIndex 开始的index(包括)
 	 * @param toIndex   结束的index(不包括)
 	 * @return 字串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String sub(CharSequence str, int fromIndex, int toIndex) {
 		if (isEmpty(str)) {
@@ -2521,8 +2460,6 @@ public class StrUtil {
 	 * @param c     被重复的字符
 	 * @param count 重复的数目,如果小于等于0则返回""
 	 * @return 重复字符字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String repeat(char c, int count) {
 		if (count <= 0) {
@@ -2542,8 +2479,6 @@ public class StrUtil {
 	 * @param str   被重复的字符
 	 * @param count 重复的数目
 	 * @return 重复字符字符串
-	 *
-	 * @since 1.0.0
 	 */
 	public static String repeat(CharSequence str, int count) {
 		if (null == str) {
@@ -2761,8 +2696,6 @@ public class StrUtil {
 	 * @param template 文本模板,被替换的部分用 {} 表示,如果模板为null,返回"null"
 	 * @param params   参数值
 	 * @return 格式化后的文本,如果模板为null,返回"null"
-	 *
-	 * @since 1.0.0
 	 */
 	public static String format(CharSequence template, Object... params) {
 		if (null == template) {