package ;
import ;
import ;
import ;
import ;
/**
* @author nachuan
* 判断 String int Collection 是否为空
*/
public class EmptyUtils implements Serializable {
/**
* 获取String不为空
* @param cs
* @return
*/
public static boolean isNotEmpty(CharSequence cs) {
return !isEmpty(cs);
}
/**
* 获取String为空
* @param cs
* @return
*/
public static boolean isEmpty(CharSequence cs) {
int strLen;
if (cs != null && (strLen = ()) != 0) {
for(int i = 0; i < strLen; ++i) {
if (!((i))) {
return false;
}
}
return true;
} else {
return true;
}
}
/**
* 获取interger不为空
* @param integer
* @return
*/
public static boolean isNotEmpty(Integer integer) {
if (integer != null && isNotEmpty(())) {
return true;
}else {
return false;
}
}
/**
* 获取interger为空
* @param integer
*
* @return
*/
public static boolean isEmpty(Integer integer) {
boolean b = isEmpty(());
if (integer == null ||(integer != null && b)) {
return true;
}else {
return false;
}
}
/**
* 获取集合类是否不为空
* @param collection
* @return
*/
public static boolean isNotEmpty(Collection<?> collection) {
return !isEmpty(collection);
}
/**
* 获取集合类是否为空
* @param collection
* @return
*/
public static boolean isEmpty(Collection<?> collection) {
return collection == null || ();
}
/**
* 获取集合类是否为空
* @param str
* @return
*/
public static ResResultDto str2num(String str) {
ResResultDto dto = new ResResultDto();
if ((str)) {
Integer integer = null;
try {
integer = (str);
(0);
("强转成功");
(integer);
return dto;
} catch (NumberFormatException e) {
();
("强转异常,参数非法,不是数字类型");
(2001);
return dto;
}
}else {
("参数为空");
(5001);
return dto;
}
}
public static String trimAll(String str ){
return ()
.replaceAll("[ *| *| *|//s*]*", "")
.replaceAll("^[ *| *| *|//s*]*", "")
.replaceAll("[ *| *| *|//s*]*$", "");
}
public static String addOrderStr2Select(String s) {
s = ().replaceAll(" +"," ");
String[] s2 = (" ");
String orderStr = "";
for (int i = 0; i < ; i++) {
if (("by", s2[i])) {
orderStr = s2[i+1];
if ((",",s2[i+2])){
}
break;
}
}
return ("select","select " + orderStr + "," );
}
}