How to use strconv.Itoa() Function in Golang? Last Updated : 03 May, 2020 Comments Improve Suggest changes Like Article Like Report Go language provides inbuilt support to implement conversions to and from string representations of basic data types by strconv Package. This package provides an Itoa() function which is equivalent to FormatInt(int64(x), 10). Or in other words, Itoa() function returns the string representation of x when the base is 10. To access Itoa() function you need to import strconv Package in your program with the help of import keyword. Syntax: func Itoa(x int) string Parameter: This function takes one parameter of int type, i.e., x. Return value: This function returns a string that represents x. Let us discuss this concept with the help of the given examples: Example 1: C // Golang program to illustrate // strconv.Itoa() Function package main import ( "fmt" "strconv" ) func main() { // Finding a string representation of // the given value when the base is 10 // Using Itoa() function fmt.Println(strconv.Itoa(23)) fmt.Println(strconv.Itoa(45)) } Output: 23 45 Example 2: C // Golang program to illustrate // strconv.Itoa() Function package main import ( "fmt" "strconv" ) func main() { // Finding a string representation of // the given value when the base is 10 // Using Itoa() function val1 := int(24) res1 := strconv.Itoa(val1) fmt.Printf("Result 1: %v", res1) fmt.Printf("\nType 1: %T", res1) val2 := int(-21) res2 := strconv.Itoa(val2) fmt.Printf("\nResult 2: %v", res2) fmt.Printf("\nType 2: %T", res2) } Output: Result 1: 24 Type 1: string Result 2: -21 Type 2: string Comment More infoAdvertise with us Next Article How to use strconv.QuoteRune() Function in Golang? A ankita_saini Follow Improve Article Tags : Go Language Golang-strconv Similar Reads How to use strconv.Quote() Function in Golang? Go language provides inbuilt support to implement conversions to and from string representations of basic data types by strconv Package. This package provides a Quote() function which is used to find a double-quoted Go string literal representing str and the returned string uses Go escape sequences 2 min read How to use strconv.IsPrint() Function in Golang? Go language provides inbuilt support to implement conversions to and from string representations of basic data types by strconv Package. This package provides an IsPrint() function which is used to check whether the rune is defined as printable by Go or not with the same definition as unicode.IsPrin 2 min read How to use strconv.IsGraphic() Function in Golang? Go language provides inbuilt support to implement conversions to and from string representations of basic data types by strconv Package. This package provides an IsGraphic() function which is used to check whether the rune is defined as a Graphic by Unicode or not. Such type of characters includes l 2 min read How to use strconv.QuoteToASCII() Function in Golang? Go language provides inbuilt support to implement conversions to and from string representations of basic data types by strconv Package. This package provides a QuoteToASCII() function which is used to find a double-quoted Go string literal representing str and the returned string uses Go escape seq 2 min read How to use strconv.QuoteRune() Function in Golang? Go language provides inbuilt support to implement conversions to and from string representations of basic data types by strconv Package. This package provides a QuoteRune() function which is used to find a single-quoted Go string literal representing rune and the returned string uses Go escape seque 2 min read How to use strconv.QuoteToGraphic() Function in Golang? Go language provides inbuilt support to implement conversions to and from string representations of basic data types by strconv Package. This package provides a QuoteToGraphic() function which is used to find a double-quoted Go string literal representing str and the returned string leaves Unicode g 2 min read Like