. 1 Package main 2 . 3 Import ( . 4 " FMT " . 5 " StrConv " . 6 ) . 7 . 8 FUNC main () { . 9 // string into integer 10 S: = " 100 " . 11 // Base specified hexadecimal (2 to 36), if the base is 0, the string will be pre-determined, "0x" are hexadecimal "0" is the 8-ary, 10-ary otherwise; 12 is // BitSize results specified assignment must be no overflow integer type, 0,8,16,32,64 representing int, int8, int16, int32, int64; err return class is * NumErr 13 // type, if a syntax error, err.Error = ErrSyntax; if results outside the range of types err.Error = ErrRange. 14 I, _: = strconv.ParseInt (S, 10, . 8 ) 15 fmt.Println (i) 16 . 17 // Integer i is converted to a string returns a string representation of the base band. base must be between 2 and 36, the results will lowercase letters 'a' to 'z' represents a number greater than 10. 18 is // STR: strconv.FormatInt = (10,4) . 19 // fmt.Println (STR) 20 is 21 is // string into a bool value bool return a string. It accepts 1,0, t, f, T, F, true, false, True, False, TRUE, FALSE; otherwise it returns an error. 22 is BOOL , _: = strconv.ParseBool ( " haha " ) 23 is fmt.Println ( BOOL ) 24 25 // string into a float 26 @If s grammatical rules, the function returns the closest s represents a floating-point value (using the IEEE754 norm rounding). bitSize desired reception specified type, 27 // 32 float32 (return value may not change the assignment to the exact numerical values float32), 64 is float64; err is the return value of type * NumErr, a syntax error, and 28 // err .Error = ErrSyntax; results expressed outside the range, return the value of f ± Inf, err.Error = ErrRange. 29 R & lt: = " 100 " 30 F, _: = strconv.ParseFloat (R & lt, 64 ) 31 is fmt.Println (F) 32 33 is }