Merge pull request #277 from LarryBattle/patch-1

Shorter example and formatting.
This commit is contained in:
astaxie
2013-12-02 17:49:06 -08:00

View File

@@ -68,7 +68,7 @@
在s字符串中去除cutset指定的字符串
fmt.Printf("[%q]", strings.Trim(" !!! Achtung !!! ", "! "))
Output:["Achtung"]
//Output:["Achtung"]
- func Fields(s string) []string
@@ -125,30 +125,25 @@
"fmt"
"strconv"
)
func checkError(e error){
if e != nil{
fmt.Println(e)
}
}
func main() {
a, err := strconv.ParseBool("false")
if err != nil {
fmt.Println(err)
}
checkError(err)
b, err := strconv.ParseFloat("123.23", 64)
if err != nil {
fmt.Println(err)
}
checkError(err)
c, err := strconv.ParseInt("1234", 10, 64)
if err != nil {
fmt.Println(err)
}
checkError(err)
d, err := strconv.ParseUint("12345", 10, 64)
if err != nil {
fmt.Println(err)
}
checkError(err)
e, err := strconv.Atoi("1023")
if err != nil {
fmt.Println(err)
}
checkError(err)
fmt.Println(a, b, c, d, e)
}
## links