Go Package strconv: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 12: Line 12:
{{External|https://pkg.go.dev/strconv#Atoi}}
{{External|https://pkg.go.dev/strconv#Atoi}}
ASCII-to-int, converts a string representation of an integer to an <code>int</code> type.
ASCII-to-int, converts a string representation of an integer to an <code>int</code> type.
<syntaxhighlight lang='go'>
import "strconv"
a := "15"
b, error := strconv.Atoi(a)
println(b, error)
</syntaxhighlight>

Revision as of 04:38, 22 August 2023

External

Internal

Overview

The strconv package contains functions to convert strings to and from other data types.

Functions

Atoi()

https://pkg.go.dev/strconv#Atoi

ASCII-to-int, converts a string representation of an integer to an int type.

import "strconv"

a := "15"
b, error := strconv.Atoi(a)
println(b, error)