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

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -