|
|
|
|
package com.util;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
public final class Common {
|
|
|
|
|
////////////<2F>ַ<EFBFBD><D6B7><EFBFBD> HTML ת<><D7AA>
|
|
|
|
|
public static String turn(String str) {
|
|
|
|
|
|
|
|
|
|
while (str.indexOf("\n") != -1) {
|
|
|
|
|
str = str.substring(0, str.indexOf("\n")) + "<br>"
|
|
|
|
|
+ str.substring(str.indexOf("\n") + 1);
|
|
|
|
|
}
|
|
|
|
|
while (str.indexOf(" ") != -1) {
|
|
|
|
|
str = str.substring(0, str.indexOf(" ")) + " "
|
|
|
|
|
+ str.substring(str.indexOf(" ") + 1);
|
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ǰ<EFBFBD><C7B0><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>0 һ<><D2BB>֮ǰ<D6AE><C7B0><EFBFBD><EFBFBD>-1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3
|
|
|
|
|
public static String getDate(int num){
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
|
|
c.add(Calendar.YEAR, num);
|
|
|
|
|
|
|
|
|
|
return df.format(c.getTime());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////<2F><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>
|
|
|
|
|
public static String SQLStr(String str){
|
|
|
|
|
|
|
|
|
|
if(str != null && str.length()>1 && str.substring(0,1).equals("?")){
|
|
|
|
|
str = str.substring(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(str == null || str.equals("") || str.equals(" ")){
|
|
|
|
|
str = " ";
|
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
/////////////<2F><><EFBFBD>˿ո<CBBF>
|
|
|
|
|
public static String PageStr(String str){
|
|
|
|
|
|
|
|
|
|
if(str==null || str.trim().equals("") || str.equals(" ")||str.equals("null")){
|
|
|
|
|
str = "";
|
|
|
|
|
}
|
|
|
|
|
str = str.trim();
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
/////////////<2F><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public static String formatRZ(String oldDate){
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Date Date = new Date(oldDate);
|
|
|
|
|
return df.format(Date);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
public static String toChineseAndTrim(String str){
|
|
|
|
|
|
|
|
|
|
if(str==null){
|
|
|
|
|
str="";
|
|
|
|
|
}
|
|
|
|
|
try{
|
|
|
|
|
byte b[]=str.getBytes("iso-8859-1");
|
|
|
|
|
str=new String(b);
|
|
|
|
|
str=str.trim();
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
}
|