|
@@ -65,7 +65,7 @@ public class StringUtil {
|
|
|
*/
|
|
|
public static String remove_ctl(String str) {
|
|
|
String trim = "";
|
|
|
- if(StringUtils.isNotEmpty(str)){
|
|
|
+ if (StringUtils.isNotEmpty(str)) {
|
|
|
trim = str.replaceAll("\r|\n|\r\n", "").trim();
|
|
|
}
|
|
|
return trim;
|
|
@@ -195,11 +195,11 @@ public class StringUtil {
|
|
|
* @param target
|
|
|
* @return
|
|
|
*/
|
|
|
-// public static boolean isSameContent(List<String> source, List<String> target) {
|
|
|
-// Set<String> sourceSet = Sets.newHashSet(source);
|
|
|
-// Set<String> targetSet = Sets.newHashSet(target);
|
|
|
-// return Sets.difference(sourceSet, targetSet).isEmpty() && Sets.difference(targetSet, sourceSet).isEmpty();
|
|
|
-// }
|
|
|
+ // public static boolean isSameContent(List<String> source, List<String> target) {
|
|
|
+ // Set<String> sourceSet = Sets.newHashSet(source);
|
|
|
+ // Set<String> targetSet = Sets.newHashSet(target);
|
|
|
+ // return Sets.difference(sourceSet, targetSet).isEmpty() && Sets.difference(targetSet, sourceSet).isEmpty();
|
|
|
+ // }
|
|
|
|
|
|
/**
|
|
|
* 解析时间
|
|
@@ -231,7 +231,7 @@ public class StringUtil {
|
|
|
* @param datetime
|
|
|
* @return
|
|
|
*/
|
|
|
- public static Date parseDateTime(String datetime,String[] dateFormats) {
|
|
|
+ public static Date parseDateTime(String datetime, String[] dateFormats) {
|
|
|
Date date = null;
|
|
|
try {
|
|
|
datetime = remove_ctl(datetime);
|
|
@@ -249,4 +249,29 @@ public class StringUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 是否是纯字母
|
|
|
+ *
|
|
|
+ * @param word
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static Boolean isWord(String word) {
|
|
|
+ Boolean isWord = false;
|
|
|
+ if (word.trim().matches("[a-zA-Z]+")) {
|
|
|
+ isWord = true;
|
|
|
+ }
|
|
|
+ return isWord;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 测试主函数
|
|
|
+ public static void main(String args[]) {
|
|
|
+ System.out.println(StringUtil.isWord(" "));
|
|
|
+ System.out.println(StringUtil.isWord(""));
|
|
|
+ System.out.println(StringUtil.isWord("高e"));
|
|
|
+ System.out.println(StringUtil.isWord("e e"));
|
|
|
+ System.out.println(StringUtil.isWord("ee"));
|
|
|
+ System.out.println(StringUtil.isWord(" ee "));
|
|
|
+ System.out.println(StringUtil.isWord("Gao"));
|
|
|
+ }
|
|
|
+
|
|
|
}
|