说我有这个字符串
[0] playerName19 [1] playerName17 [2] playerName18 [3] playerName15 [4] playerName59 [5] playerName16 [6] playerName6 [7] playerName60
如何使用Java将其拆分为类似的内容:
[0] playerName19, [1] playerName17, [2] playerName18...
我尝试使用split(),但是问题是playerName数字扩展名是随机生成的,并且每个查询都会更改。
只需根据之前存在的空间进行拆分即可[num]
。
string.split("\\s+(?=\\[\\d+\\])");
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句