hi everyone,
I have written a code to cut the strings. But I am facing some problems in
StringTokenizer() . It is not accepting some delimiters such as { " and
space}.
The program written by me is:
import java.util.StringTokenizer;
class STDemo2
{
static String in="210.18.21.182 - - [26/Feb/2001:01:00:02 +051800] GET
/professionals/index.htm HTTP/1.0 200 19095; ";
public static void main(String args[])
{
StringTokenizer st=new StringTokenizer(in," ");
while(st.hasMoreTokens())
{
String key=st.nextToken("[]+/ ");
String val=st.nextToken();
System.out.print(key + "\t " + val );
}
}
}
How to overcome this problem.Please suggest solution.
Thanks in advance