Standard library / strconv
strconv.Itoa()
Returns the base-10 string representation of an int, including a minus sign for negative values. Expected stdout: '-42\n'.
Formal Syntax & Structure
go syntaxgo
func Itoa(i int) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| i | int | Integer value to encode. |
Return Value
string
Encoded representation.
Working Example
Example Snippetgo
package main
import ( "fmt" "strconv")
func main() { fmt.Println(strconv.Itoa(-42))}