http://play.golang.org/p/ZsALO8oF3WGo, Golang: stringa di accesso come valore di carattere
voglio attraversare una stringa e restituire i valori dei caratteri. Come faccio a non restituire i valori numerici per ogni lettera e restituire i caratteri reali?
Ora sto ottenendo questo
0 72 72
1 101 101
2 108 108
3 108 108
4 111 111
mio output desiderato sarebbe
0 h h
1 e e
2 l l
3 l l
4 o o
package main
import "fmt"
func main() {
str := "Hello"
for i, elem := range str {
fmt.Println(i, str[i], elem)
}
for elem := range str {
fmt.Println(elem)
}
}
Grazie,