1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| package main
import ( "fmt" "strconv" )
func main() { str := make([]byte, 0, 100) fmt.Printf("strconv.AppendInt(str, 4567, 10): %v\n", strconv.AppendInt(str, 4567, 10)) fmt.Printf("strconv.AppendBool(str, true): %v\n", strconv.AppendBool(str, true)) fmt.Printf("strconv.AppendQuote(str, \"mebaron\"): %v\n", strconv.AppendQuote(str, "mebaron")) fmt.Printf("strconv.AppendQuoteRune(str, '龙'): %v\n", strconv.AppendQuoteRune(str, '龙'))
fmt.Printf("strconv.FormatBool(false): %v\n", strconv.FormatBool(false)) fmt.Printf("strconv.FormatFloat(100.23, 'g', 12, 64): %v\n", strconv.FormatFloat(100.23, 'g', 12, 64)) fmt.Printf("strconv.FormatInt(1314, 10): %v\n", strconv.FormatInt(1314, 10)) fmt.Printf("strconv.FormatUint(1523, 10): %v\n", strconv.FormatUint(1523, 10)) fmt.Printf("strconv.Itoa(1024): %v\n", strconv.Itoa(1024))
fmt.Println(strconv.ParseBool("true")) fmt.Println(strconv.ParseFloat("12.234", 64)) fmt.Println(strconv.ParseInt("123456", 10, 64)) fmt.Println(strconv.ParseUint("13520", 10, 64)) fmt.Println(strconv.Atoi("12345")) }
|