Standard library / strconv
strconv.FormatInt()
Formats a signed int64 in base 2–36 using lowercase digits; invalid bases panic. Negative values receive a minus sign. Expected stdout: '-1f\n'.
Formal Syntax & Structure
go syntaxgo
func FormatInt(i int64, base int) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| i | int64 | Integer value to encode. |
| base | int | Output radix 2–36. |
Return Value
string
Encoded representation.
Working Example
Example Snippetgo
package main
import ( "fmt" "strconv")
func main() { fmt.Println(strconv.FormatInt(-31, 16))}