Monday, July 31, 2006

Java: Replace space

[code]
String a = "aaa cc bb c";
String b = a.replaceAll(" ","");
System.out.println("b: "+b);
[/code]

Thursday, July 20, 2006

Java: 0 supplement to 6 digits

import java.text.*;

System.out.println("0 Supplement");
String txtSEQ_NO = "123";
double dSEQ_NO = Double.parseDouble(txtSEQ_NO);
DecimalFormat d1 = new DecimalFormat("000000");
System.out.println("d1 = " + d1.format(dSEQ_NO));
String a = String.valueOf(d1.format(dSEQ_NO));
System.out.println("a = " + a);

Sunday, July 16, 2006

HTML: Removing Link Underline

STYLE="text-decoration: none"


This is an unusual link, it has no underline

Tuesday, July 11, 2006

Java Parse string

import java.util.*;

class ParseString
{
public static void main (String args[])
{
String s = "first,second, third fourth, fifth";
StringTokenizer st;

st = new StringTokenizer (s, ", ");

while (st.hasMoreTokens ())
{
System.out.println (">>" + st.nextToken () + "<<");
}
}
}


The output is:

>>first<<
>>second<<
>>third<<
>>fourth<<
>>fifth<<

Monday, July 03, 2006

Java: jsp sql debugging

To check sql codes, put following codes on jsp page:
//
// Put following codes on the top of page(remove //)
//
// page import="java.io.File"
// page import="java.io.FileInputStream"
// page import="java.io.FileOutputStream"
// page import="java.io.FileReader"
// page import="java.io.FileWriter"
//
// ------------------------------------
//
// build sql string here
//
// ------------------------------------
//
// Debug
//
BufferedWriter fout=new BufferedWriter(new FileWriter("c:/temp/debug/debug.txt",true));
fout.write(sql.toString());
fout.newLine();
fout.close();