go - Golang : convert uint8 to string -


http://play.golang.org/p/bozkhc8_ua

i want convert uint8 string can't figure out how.

  package main    import "fmt"   import "strconv"    func main() {      str := "hello"     fmt.println(str[1])  // 101      fmt.println(strconv.itoa(str[1]))   } 

this gives me prog.go:11: cannot use str[1] (type uint8) type int in function argument [process exited non-zero status]

any idea?

simply convert it :

    fmt.println(strconv.itoa(int(str[1]))) 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -