Golang przekształca sznurki, ints z Itoa
Golang program that converts strings, ints with Itoa
package main
import (
"fmt"
"strconv"
)
func main() {
value := 120
// Use Itoa to convert int to string.
result := strconv.Itoa(value)
fmt.Println(result)
if result == "120" {
fmt.Println(true)
}
// Use Atoi to convert string to int.
original, _ := strconv.Atoi(result)
if original == 120 {
fmt.Println(true)
}
}
Output
120
true
true
Grumpy Giraffe