go語言遍歷中文字符串如何實現
1 回答

一只甜甜圈
TA貢獻1836條經驗 獲得超5個贊
用length()方法、charAt方法結合for循環就行了,
package com.golden.test;public class TestString { public static void main(String[] args) { String str = "你叫神馬?我叫Tesson."; for (int i = 0; i < str.length(); i++) { char item = str.charAt(i); System.out.println(item); } }}
- 1 回答
- 0 關注
- 1207 瀏覽
添加回答
舉報
0/150
提交
取消