|
|
|
@ -19,7 +19,8 @@ public class StringUtil { |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static boolean isEqual(String str1,String str2){ |
|
|
|
|
if (isNull(str1)||isNull(str2)){ |
|
|
|
|
|
|
|
|
|
if (isEmpty(str1)||isEmpty(str2)){ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return str1.equals(str2); |
|
|
|
@ -30,15 +31,9 @@ public class StringUtil { |
|
|
|
|
* @param str1 |
|
|
|
|
* @return 为空返回true |
|
|
|
|
*/ |
|
|
|
|
public static boolean isNull(String str1){ |
|
|
|
|
public static boolean isEmpty(String str1){ |
|
|
|
|
|
|
|
|
|
if (str1==null){ |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
if (str1 == ""||"".equals(str1)){ |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
return str1==null||str1.length()==0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -48,7 +43,7 @@ public class StringUtil { |
|
|
|
|
*/ |
|
|
|
|
public static boolean isNotNull(String str1){ |
|
|
|
|
|
|
|
|
|
return !isNull(str1); |
|
|
|
|
return !isEmpty(str1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -143,5 +138,12 @@ public class StringUtil { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
|
|
|
|
String text = "你好[xxxxx]"; |
|
|
|
|
System.out.println(text.indexOf("[")); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|