Created
August 13, 2023 08:15
-
-
Save basicmag/83bd4d664a26e6ddc03e7dceab4f81ab to your computer and use it in GitHub Desktop.
Go言語: fmt.Sprintfを使ってintを文字列に変換する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Go言語 必読本 Essential Go | |
| // https://www.amazon.co.jp/dp/B0CF53VMYB | |
| // | |
| // Go言語: fmt.Sprintfを使ってintを文字列に変換する | |
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| func main() { | |
| var i1 int = -38 | |
| s1 := fmt.Sprintf("%d", i1) | |
| fmt.Printf("i1: %s\n", s1) | |
| var i2 int32 = 148 | |
| s2 := fmt.Sprintf("%d", i2) | |
| fmt.Printf("i2: %s\n", s2) | |
| } | |
| // Go言語 必読本 Essential Go | |
| // https://www.amazon.co.jp/dp/B0CF53VMYB | |
| // | |
| // Essential Go | |
| // https://www.programming-books.io/essential/go/ | |
| // By Krzysztof Kowalczyk | |
| // | |
| // Content is licensed under Creative Commons Attribution-ShareAlike 3.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment