Wie konvertiert uint8 string

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

Ich konvertieren wollen uint8 string, kann aber nicht herausfinden, wie.

  package main

  import "fmt"
  import "strconv"

  func main() {

    str := "Hello"
    fmt.Println(str[1])  //101

    fmt.Println(strconv.Itoa(str[1]))
  }

Das gibt mir prog.go:11: cannot use str[1] (type uint8) as type int in function argument
[process exited with non-zero status]

Irgendeine Idee?

InformationsquelleAutor | 2013-10-07
Schreibe einen Kommentar