Multiple delimiters in Scanner class of Java -
how use usedelimiter()
method of scanner
class use both comma (,) , new line character (\n) delimiters?
i parsing text csv file.
scanner s = new scanner("hello, world \n hello world"); s.usedelimiter(",|\\n"); while(s.hasnext()){ system.out.println(s.next()); }
output
hello world hello world
Comments
Post a Comment