|  | @@ -1,6 +1,7 @@
 | 
	
		
			
				|  |  |  package com.sysu.admin.utils;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.dom4j.Document;
 | 
	
		
			
				|  |  |  import org.dom4j.DocumentException;
 | 
	
		
			
				|  |  |  import org.dom4j.DocumentHelper;
 | 
	
	
		
			
				|  | @@ -16,13 +17,13 @@ import java.util.regex.Pattern;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  public class TextUtil {
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 把10000(第一位代表小时,第二位三位代表分,第四位 五位代表秒)
 | 
	
		
			
				|  |  |  	 * 把这种格式转换为秒
 | 
	
		
			
				|  |  |  	 * @param time
 | 
	
		
			
				|  |  |  	 * @return
 | 
	
		
			
				|  |  | -	 * @throws ParseException 
 | 
	
		
			
				|  |  | +	 * @throws ParseException
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	public static Integer timeConvert(String time,String format){
 | 
	
		
			
				|  |  |  		time=time.trim();
 | 
	
	
		
			
				|  | @@ -35,14 +36,14 @@ public class TextUtil {
 | 
	
		
			
				|  |  |  		Calendar c= f.getCalendar();
 | 
	
		
			
				|  |  |  		return c.get(Calendar.HOUR)*3600+c.get(Calendar.MINUTE)*60+c.get(Calendar.SECOND);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 把10000(第一位代表小时,第二位三位代表分,第四位 五位代表秒)
 | 
	
		
			
				|  |  |  	 * 把这种格式转换为秒
 | 
	
		
			
				|  |  |  	 * 以上意思相反
 | 
	
		
			
				|  |  |  	 * @param second
 | 
	
		
			
				|  |  |  	 * @return
 | 
	
		
			
				|  |  | -	 * @throws ParseException 
 | 
	
		
			
				|  |  | +	 * @throws ParseException
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	public static String timeConvert(Integer second){
 | 
	
		
			
				|  |  |  		int h,m,s;
 | 
	
	
		
			
				|  | @@ -51,7 +52,7 @@ public class TextUtil {
 | 
	
		
			
				|  |  |  		s=second%60;
 | 
	
		
			
				|  |  |  		return h+save2w(m)+save2w(s);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 保留两位
 | 
	
		
			
				|  |  |  	 * @param number (例如输入9)
 | 
	
	
		
			
				|  | @@ -60,9 +61,9 @@ public class TextUtil {
 | 
	
		
			
				|  |  |  	public static String save2w(Integer number) {
 | 
	
		
			
				|  |  |  		return number > 9 ? (number + "") : "0" + number;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 逗号分隔符添加字符串
 | 
	
		
			
				|  |  |  	 */
 | 
	
	
		
			
				|  | @@ -73,42 +74,42 @@ public class TextUtil {
 | 
	
		
			
				|  |  |  			return new StringBuffer(mainContent).append(",").append(text).toString();
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 找到字符串中的数字  例子‘胡椒粉00’  返回00 只会匹配第一个
 | 
	
		
			
				|  |  |  	 * @return
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	public static String findNumber(String text) {
 | 
	
		
			
				|  |  | -		Pattern p=Pattern.compile("\\d+"); 
 | 
	
		
			
				|  |  | +		Pattern p=Pattern.compile("\\d+");
 | 
	
		
			
				|  |  |  		Matcher m=p.matcher(text);
 | 
	
		
			
				|  |  | -		if(m.find()) {//匹配2223 
 | 
	
		
			
				|  |  | -//		m.start();//返回3 
 | 
	
		
			
				|  |  | -//		m.end();//返回7,返回的是2223后的索引号 
 | 
	
		
			
				|  |  | +		if(m.find()) {//匹配2223
 | 
	
		
			
				|  |  | +//		m.start();//返回3
 | 
	
		
			
				|  |  | +//		m.end();//返回7,返回的是2223后的索引号
 | 
	
		
			
				|  |  |  			return m.group();
 | 
	
		
			
				|  |  |  		}else {
 | 
	
		
			
				|  |  |  			return null;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 找到字符串中的数字  例子‘胡椒粉00’  返回胡椒粉 只会匹配第一个
 | 
	
		
			
				|  |  |  	 * @return
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	public static String findNotNumber(String text) {
 | 
	
		
			
				|  |  | -		Pattern p=Pattern.compile("[^0-9]+"); 
 | 
	
		
			
				|  |  | +		Pattern p=Pattern.compile("[^0-9]+");
 | 
	
		
			
				|  |  |  		Matcher m=p.matcher(text);
 | 
	
		
			
				|  |  |  		if(m.find()) {//匹配
 | 
	
		
			
				|  |  |  //		m.start();//返回3
 | 
	
		
			
				|  |  | -//		m.end();//返回7,返回的是后的索引号 
 | 
	
		
			
				|  |  | +//		m.end();//返回7,返回的是后的索引号
 | 
	
		
			
				|  |  |  			return m.group();
 | 
	
		
			
				|  |  |  		}else {
 | 
	
		
			
				|  |  |  			return null;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 取出两个标识符中间的字符串
 | 
	
		
			
				|  |  |  	 * @param left
 | 
	
	
		
			
				|  | @@ -124,7 +125,7 @@ public class TextUtil {
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		return null;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 取标识符前面的字符串
 | 
	
		
			
				|  |  |  	 * @param left
 | 
	
	
		
			
				|  | @@ -137,8 +138,8 @@ public class TextUtil {
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		return null;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 取标识符后面的字符串
 | 
	
		
			
				|  |  |  	 * @param right
 | 
	
	
		
			
				|  | @@ -151,7 +152,7 @@ public class TextUtil {
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		return null;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	/**
 | 
	
		
			
				|  |  |  	 * 将xml 字符串转化为json 对象
 | 
	
		
			
				|  |  |  	 * @param xmlString
 | 
	
	
		
			
				|  | @@ -175,12 +176,12 @@ public class TextUtil {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	public static String[] split(String text,String regex) {
 | 
	
		
			
				|  |  |  		int index = 0;
 | 
	
		
			
				|  |  | -		if(text == null) {
 | 
	
		
			
				|  |  | +		if(StringUtils.isBlank(text)) {
 | 
	
		
			
				|  |  |  			return new String[0];
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		String[] codeArray = text.split(regex);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		if(text.equals("") || codeArray.length == 0) {
 | 
	
		
			
				|  |  | +		if(codeArray.length == 0) {
 | 
	
		
			
				|  |  |  			return new String[0];
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 |