目前分類:Java (59)
- Dec 21 Wed 2011 10:58
Java - append data to file
- Dec 15 Thu 2011 15:56
java - How to use HashTable
HashTable can improve our search time when we need to find data.
There is a example for HashTable class in java :
import java.util.Hashtable;
- Dec 15 Thu 2011 00:30
java - 檢查空白行
- Dec 13 Tue 2011 23:57
java - invert Chinese words to Unicode
There is a file , native2ascii.exe , in jdk bin folder.
We can use this execution file to achieve our purpose.
- Dec 12 Mon 2011 23:48
java - set the hosts when we won't connect through proxy
http.nonProxyHosts (default: <none>)
1. a wildcard character (*) can be used for matching.
- Dec 12 Mon 2011 23:44
java - remove proxy properties
- Dec 12 Mon 2011 21:58
java - Set Proxy
- Dec 12 Mon 2011 21:31
java - Show IP address and hostname of Local Machine
- Dec 09 Fri 2011 16:22
java - Delay program to execute (Time delay)
- Dec 09 Fri 2011 10:51
java - System pause
Java is not like c programming language , it doesn't have the command system("pasue").
But we can use some method to implement the similar function.
- Dec 09 Fri 2011 09:26
java - 分割字串
We can use String.split method to split the string into tokens.
String[] result = "this is a book".split("\\s");
for (int x=0; x<result.length; x++)
{
System.out.println(result[x]);
}
The result will be:
this
is
a
book
We also can use StringTokenizer class to achieve the result we want.
The StringTokenizer is defined as StringTokenizer(String str, String delim)
code example:
StringTokenizer st = new StringTokenizer("this is a book" , " ");
while (st.hasMoreTokens())
{
System.out.println(st.nextToken());
}
ref:http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html
- Dec 08 Thu 2011 22:23
java - Read File
- Dec 08 Thu 2011 22:00
java - Read File encoded by UTF-16 (UCS-2 little endian)
- Dec 06 Tue 2011 16:22
Java - Pattern and Matcher
- Dec 06 Tue 2011 16:13
java - regular expression
- Dec 06 Tue 2011 13:03
Java - redirect the std out to file
- Sep 06 Mon 2010 22:59
字串比對 & 字元的輸入
- Aug 08 Sun 2010 12:21
Hello World!