java string delimiter, keeping delimiter in token

前端 未结 3 503
没有蜡笔的小新
没有蜡笔的小新 2021-01-26 00:06

im trying to split a string but keep the delimiter at the beginning of the next token (if thats possible)

Example: I\'m trying to split the string F120LF120L

3条回答
  •  梦谈多话
    2021-01-26 00:57

    From the docs, you can use StringTokenizer st = new StringTokenizer(str, "L", true); The last parameter is a boolean that specifies that delimiters have to be returned too.

提交回复
热议问题