要注意裡面放的數值不是字元,而是數字
如果要取出字元要用%c轉換
s := "abc" for i, v := range s { fmt.Print(i, ",") fmt.Print(v, ",") fmt.Printf("%c", v) fmt.Println() } 0,97,a 1,98,b 2,99,c
Last updated 1 year ago