From bc546c84f344b0d4413555dc0b7c76fbcb87cbd1 Mon Sep 17 00:00:00 2001 From: levis9527 <804724431@qq.com> Date: Tue, 15 Mar 2022 12:04:00 +0800 Subject: [PATCH] some comments(#9741) --- .../dubbo/common/utils/StringUtils.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java index 3332b40024..f51fcbbf93 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java @@ -515,8 +515,10 @@ public final class StringUtils { } /** - * @param s1 - * @param s2 + * if s1 is null and s2 is null, then return true + * + * @param s1 str1 + * @param s2 str2 * @return equals */ public static boolean isEquals(String s1, String s2) { @@ -530,19 +532,31 @@ public final class StringUtils { } /** - * is integer string. + * is positive integer or zero string. * - * @param str - * @return is integer + * @param str a string + * @return is positive integer or zero */ public static boolean isNumber(String str) { return isNotEmpty(str) && NUM_PATTERN.matcher(str).matches(); } + /** + * parse str to Integer(if str is not number or n < 0, then return 0) + * + * @param str a number str + * @return positive integer or zero + */ public static int parseInteger(String str) { return isNumber(str) ? Integer.parseInt(str) : 0; } + /** + * parse str to Long(if str is not number or n < 0, then return 0) + * + * @param str a number str + * @return positive long or zero + */ public static long parseLong(String str) { return isNumber(str) ? Long.parseLong(str) : 0; }