string tokenizer in Java

后端 未结 7 1300
耶瑟儿~
耶瑟儿~ 2020-12-02 20:58

I have a text file which contains data seperated by \'|\'. I need to get each field(seperated by \'|\') and process it. The text file can be shown as below :

7条回答
  •  一向
    一向 (楼主)
    2020-12-02 21:31

    you can use the constructor that takes an extra 'returnDelims' boolean, and pass true to it. this way you will receive the delimiters, which will allow you to detect this condition.

    alternatively you can just implement your own string tokenizer that does what you need, it's not that hard.

提交回复
热议问题