首页 文章

Tasker变量编辑添加逗号

提问于
浏览
0

我需要在变量中编辑字符串值 .

所以,

00343755932

应转换为:

0,0,3,4,3,7,5,5,9,3,2

因为我必须将每个数字定义为一个可读的变量数组 .

1 回答

  • 1

    如果我是对的,你试图从字符串创建一个数组 . 使用以下代码

    String val = "00343755932";
            int[] numberArray = new int[val.length()];
            Matcher match = Pattern.compile("[0-9]").matcher(val);
            int i = 0;
            while(match.find()) {
                System.out.println(match.group());
                numberArray[i] = Integer.parseInt(match.group());
                i++;
            }
    

相关问题