some converts
This commit is contained in:
parent
d120f91975
commit
dc9599eee3
1
README
1
README
@ -84,3 +84,4 @@ gobyexample.com signups
|
|||||||
* connection pool
|
* connection pool
|
||||||
* ruby enumerable
|
* ruby enumerable
|
||||||
* ruby string
|
* ruby string
|
||||||
|
* quoting
|
||||||
|
20
src/xx-convert.go
Normal file
20
src/xx-convert.go
Normal 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)
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user