Golang strconv.FormatUint() function is used to return the string representation of x in the given base, i.e., 2 <= base <= 36.
Syntax
func FormatUint(i uint64, base int) string
Parameters
- “i” is the unsigned integer value of type uint64 that you want to convert to a string representation.
- “base” is an int representing the base (radix) of the number system to use for the string representation (e.g., 2 for binary, 10 for decimal, 16 for hexadecimal).
Return value
It returns a string representing the given unsigned integer value in the specified base.
Example
package main
import (
"fmt"
"strconv"
)
func main() {
var myUint uint = 123
// Convert uint to string using strconv.FormatUint() with base 10 (decimal)
myString := strconv.FormatUint(uint64(myUint), 10)
fmt.Println("Converted uint to string:", myString)
}
Output
Converted uint to string: 123
Related posts
strconv.AppendQuoteRuneToGraphic()
strconv.AppendQuoteRuneToASCII()

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.