How to separate specific elements in string java

前端 未结 3 2029
面向向阳花
面向向阳花 2021-01-27 18:25

Example of what I want to do:
If you pass in \"abc|xyz\" as the first argument and \"|\" as the second argument the method returns List(\"abc

3条回答
  •  清歌不尽
    2021-01-27 19:06

    If you want to do this using characters...

    1. Get the whole string
    2. Read character by character into a new string
    3. If you find the delimiter, add new string to list. Empty new string.
    4. Repeat.

提交回复
热议问题