Tasker variable editing add commas

629 views Asked by At

I need to edit the string value in variable.

So,

00343755932

should be converted to:

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

because I must define each number as an variable array for readable one by one.

1

There are 1 answers

1
ASP On

if I'm right you are trying to create an array from string. Use following code

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++;
        }