Unable to parse ^ character

前端 未结 3 953
情深已故
情深已故 2021-01-27 15:06

Okay, Now I am able to parse space which was my previous problem. Now my parser is almost ready but has a defect which I am unable to figure out.

I am able to retrieve D

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-27 15:51

    Use method Sting.split(). Think about all your delimiters and put they all as an argument to split. Be aware that split works with regex, so special characters like | must be escaped. For example line:

    String[] tokens = str.split("[\\s+\\|]");

    should create expected tokens from your input.

提交回复
热议问题