?? htmlchange.java
字號:
package find;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.StringTokenizer;
import java.awt.Color;
import java.util.Vector;
public class HtmlChange{
//將文章分段并且轉(zhuǎn)換html代碼的函數(shù)
//< <
//> >
//& &
//連續(xù)空格
//\n <br>\n
public static String setArticle(String test){
String result = test;
result = HtmlChange.replaceCode(result,"&","&");
result = HtmlChange.replaceCode(result,"<","<");
result = HtmlChange.replaceCode(result,">",">");
result = HtmlChange.replaceCode(result,"\n","<br>\n");
result = HtmlChange.replaceCode(result," "," ");
//" ----- "
//' ----- '
return "\n\n"+result+"\n\n";
}
public static String replaceCode(String test,String needToBeReplaced,String replaceChar){
if (test == null||test.equals("")) return "";
String result = "";
StringTokenizer strt=new StringTokenizer(test,needToBeReplaced);
while(strt.hasMoreTokens()){
result=result+replaceChar+strt.nextToken();
}
return result.substring(result.indexOf(replaceChar)+replaceChar.length());
}
/*
public static String setArticle(String s){
String result;
String s1;
String s2;
result = "";
s1 = "";
int length = s.length();
for(int i = 0;i<length;i++){
s1 = s.substring(i,i+1);
if(s1.equals("\n")) s1 ="<br>\n";
else if(s1.equals("<")) s1 = "<";
else if(s1.equals(">")) s1 = ">";
else if(s1.equals("&")) s1 = "&";
else if(s1.equals(" ")){
s2 = " ";
while(true){
if(i>length-2) break;
if(s.substring(i+1,i+2).equals(" ")){
s2 = s2 + " ";
i++;
}
else break;
}
s1 = s2;
}
result = result+s1;
}
return "\n\n"+result+"\n\n";
}
*/
//去掉null和亂碼
public static String noNullNoUnkownChar(String s){
if(s!=null) return URLDecoder.decode(s);
else return "";
}
public static String StringNumberAddOne(String s){
if(s!=null){
String s1 = String.valueOf(Integer.parseInt(s)+1);
int i = s.length()-s1.length();
if(i>0) s1=s.substring(0,i)+s1;
return s1;
}else return "0";
}
public static void main(String args[]){
//System.out.println(HtmlChange.sql("select t.title_id,t.title,p.pub_name,a.royaltyper from titles t ,publishers p,titleauthor a where t.pub_id=p.pub_id and t.title_id = a.title_id"));
String s = "select S.sellGoodsID,S.checkTime,G.codeNumber,C.companyName,S.wetAmount,S.dryAmount,S.price,S.inNoTax,S.shouldPay,S.remain,S.isPaied from sellGoodsTable S,goodsTable G,companyTable C order by S.checkTime desc";
System.out.println(new StringBuffer(Integer.toHexString(Color.HSBtoRGB(0.6f,0.7f,0.9f)&0x00ffffff)).toString());
Vector v=new Vector();
v.firstElement(.add("");
}
public static String sqlinsert(String s){
String a,b;
String upper = s.toUpperCase();
if(s.matches("(?i).* ORDER BY .*")){
a = s.substring(0,upper.lastIndexOf(" ORDER BY "));
b = s.substring(upper.lastIndexOf(" ORDER BY "),s.length());
}else{
a = s;
b = "";
}
System.out.println(a);
System.out.println(b);
if(a.matches("(?i).* WHERE .*")){
a = a + " and ";
}else{
a = a + " where ";
}
a = a + " sdda like '%sfsa%' ";
s = a + b;
System.out.println(s);
return null;
}
public static String decode(String s){
return URLDecoder.decode(s);
}
public static String encode(String s){
try{
return new String(s.getBytes("GBK"),"ISO8859_1");
}catch(Exception e){
return "Error Happened!";
}
}
public static String sql(String s){
s = s.substring(0,s.toUpperCase().indexOf("FROM"));
s.split(",");
return null;
}
public static String Pdecode(String s){
try{
return new String(s.getBytes("ISO-8859-1"),"GB2312");
}catch(Exception e){
return "Error Happened!";
}
}
public static String Pencode(String s){
try{
return new String(s.getBytes("GB2312"),"ISO-8859-1");
}catch(Exception e){
return "Error Happened!";
}
}
public static String fhc(int rgb){
StringBuffer hc = new StringBuffer(Integer.toHexString(rgb&0x00fffff));
if(hc.length()!=6){
hc.insert(0,"\"#00");
}else
hc.insert(0,"\"#");
hc.append("\"");
return hc.toString();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -