some converts

This commit is contained in:
Mark McGranaghan 2012-09-18 16:16:09 -07:00
parent d120f91975
commit dc9599eee3
2 changed files with 21 additions and 0 deletions

1
README
View File

@ -84,3 +84,4 @@ gobyexample.com signups
* connection pool
* ruby enumerable
* ruby string
* quoting

20
src/xx-convert.go Normal file
View File

@ -0,0 +1,20 @@
package main
import ("fmt"; "strconv")
func main() {
b, _ := strconv.ParseBool("true")
fmt.Println(b)
f, _ := strconv.ParseFloat("1.234", 64)
fmt.Println(f)
i, _ := strconv.ParseInt("123", 0, 64)
fmt.Println(i)
d, _ := strconv.ParseInt("0x1b3e", 0, 64)
fmt.Println(d)
k, _ := strconv.Atoi("456")
fmt.Println(k)
}