- String str = "129873478123578";
- char[] nums = {'0','1','2','3','4','5','6','7','8','9'};
- char[] cns = {'零','壹','贰','叁','肆','伍','陆','柒','捌','玖'};
-
- for(int i = 0; i < 10; i++) {
- str.replace(nums[i], cns[i]);
- }
- System.out.println(str);
复制代码
我想知道为什么字符串中的内容没有被替换掉呢 |
|