LoginSignup
4

More than 5 years have passed since last update.

Golangのstrconvパッケージについて

Last updated at Posted at 2014-07-21

strconvパッケージは、文字列と基本データ型の双方向変換を実装している。

文字列を数値に変換する

よく使いそうなのは
func Atoi(s string) (i int, err os.Error)
だろう。
ParseInt(s, 10, 0)
の省略系でもある。


a, _ := strconv.Atoi("135")
fmt.Println(a) // => 135

b, _ := strconv.ParseInt("135", 10, 0)
fmt.Println(b) // => 135

Package strconv

内容薄すぎ。
追記予定です。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4