我有一个数学表达式字符串。示例:“(((14 + 53)+ 62)”,我想将String转换为chars数组。范例['(','(','14','+','53','+','62',')']
当我在字符串上使用方法.toCharArray时,它将转换为字符数组,但是对于大于9的数字(Multi-Digit),它将将该数字拆分为单个数字。示例:['(','(','1','4','5','3','+''6','2',')']
如何将包含多个数字的字符串转换为字符数组?
public class Testing {
public static void main(String[] args) {
String stringNumbers = "24 23 84 12 41 52 54";
char[] charNumArray = stringNumbers.toCharArray();
System.out.println(Arrays.toString(charNumArray));
}
}