如何使用正斜杠分割字符串?我尝试了以下代码:
I have string String x="10/20//30;expecting values 10,20,30.
When I tried to split using x.split("/"); then it only splitting 10,20,"",30
When I tried to split using x.split("//"); then it only splitting 10/20,30.
请帮助我正确分割。如果存在2个斜杠,是否可以跳过一个斜杠?
问候,武里
你可以做
String[] array = x.split("/+");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句