Files
the-way-to-go_ZH_CN/eBook/examples/chapter_4/string_conversion.go
2013-04-21 19:25:28 -04:00

21 lines
329 B
Go

package main
import (
"fmt"
"strconv"
)
func main() {
var orig string = "666"
var an int
var newS string
fmt.Printf("The size of ints is: %d\n", strconv.IntSize)
an, _ = strconv.Atoi(orig)
fmt.Printf("The integer is: %d\n", an)
an = an + 5
newS = strconv.Itoa(an)
fmt.Printf("The new string is: %s\n", newS)
}