我正在使用以下 java 代码将数字转换为阿拉伯语
String str = "1234-5678-9101";
char[] chars = {'٠','١','٢','٣','٤','٥','٦','٧','٨','٩'};
StringBuilder builder = new StringBuilder();
for (int i = 0; i < str.length(); ++i) {
if (Character.isDigit(str.charAt(i))) {
builder.append(Chars[(int)(str.charAt(i))-48]);
} else {
builder.append(str.charAt(i));
}
}
预期的输出是٩١٠١-٥٦٧٨-١٢٣٤,但结果是١٢٣٤-٥٦٧٨-٩١٠١(反向)