win.hupubao.common.utils.StringUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hupubao-common Show documentation
Show all versions of hupubao-common Show documentation
简单封装公共工具,二维码工具,驼峰转换工具,des加解密工具,http访问工具,字符串工具,日期工具
package win.hupubao.common.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.util.regex.Pattern.compile;
/**
* @author feihong
* @date 2017-08-10
*/
public class StringUtils {
public static boolean isBlank(Object obj) {
return obj == null || org.apache.commons.lang3.StringUtils.isBlank(obj.toString())
|| obj.toString().equalsIgnoreCase("null");
}
public static boolean isNotBlank(Object obj){
return !isBlank(obj);
}
public static Integer parseInteger(String str) {
String regEx="[^0-9]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
return Integer.valueOf(m.replaceAll("").trim());
}
/**
* 首字母转大写
* @param name
* @return
*/
public static String firstToUpperCase(String name) {
return StringUtils.isBlank(name) ? "" : name.substring(0, 1).toUpperCase() + name.substring(1);
}
/**
* 首字母转小写
* @param name
* @return
*/
public static String firstToLowerCase(String name) {
return StringUtils.isBlank(name) ? "" : name.substring(0, 1).toLowerCase() + name.substring(1);
}
public static void main(String[] args) {
String str = "int(12)";
System.out.println(parseInteger(str));
}
public static String join(Object[] strAry, String join){
StringBuffer sb=new StringBuffer();
for(int i=0;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy