Error using split method in Codenameone

后端 未结 2 1464
有刺的猬
有刺的猬 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 08:07

    Why don't you try this?

        import java.util.StringTokenizer;
        ... ...
        String fruits = "apple:pear:grape";
        String delimiter = ":";
        StringTokenizer fruitsTokenizer = new StringTokenizer(fruits, delimiter);
        while (fruitsTokenizer.hasMoreTokens()) {
                String fruit = fruitsTokenizer.nextToken();
                //
                // Do here something you want...
                //
        }
    

提交回复
热议问题