Error using split method in Codenameone

后端 未结 2 1495
有刺的猬
有刺的猬 2021-01-25 07:41

I have created a new Codenameone project. It contains the following code:

String values = \"one, two, tree\";
String[] v = values.split(\",\");
         


        
2条回答
  •  醉酒成梦
    2021-01-25 07:48

    Codename One supports a subset of Java 5 and String.split() isn't there. Its much harder to change the VM implementation code across all platforms than just add a portable library in the codename one package space. Its also harder to make all the edge cases 100% compatible and it makes the executable larger (you pay for String.split even if you don't use it!).

    We have StringUtils and StringTokenizer, there is also a regex package in the cn1lib section.

提交回复
热议问题