Multiple delimiters in Scanner class of Java

前端 未结 6 1370
深忆病人
深忆病人 2020-12-03 17:04

How do I use the useDelimiter() method of the Scanner class to use both the comma (,) and the new line character (\\n) as delimiters?

I am

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 17:44

    Jigar is absolutely correct. But if it doesn't work, try ",|\\r"

    since most text files have \r\n instead of just \n

提交回复
热议问题