I have seen several post regarding this.But they tell about split not StringTokenizer
.
This is my input file:inputfile with tab delimiter
I wrote stringTokenizer to get each value in a line.So I am able to get
1.0 3.0
delim1.0
delim3.0
so on
But when I tried to take delimiter as an argument it is not working fine for me.
while ((sCurrentLine = br.readLine()) != null) {
System.out.println(sCurrentLine);
StringTokenizer st = new StringTokenizer(sCurrentLine, args[0]);
while(st.hasMoreTokens()){
System.out.println("delim"+st.nextToken());
}
}
1.passed " "
(by pressing "Tab" key in keyboard
)as an argument ,It is working fine.
2.passed "\t"
as an argument.It is showing
1.0 3.0
delim1.0 3.0
3.passed \t
as an argument.It is showing the same
1.0 3.0
delim1.0 3.0
Why is it so.