Standard library / strconv
strconv.ParseUint()
Parses unsigned integer text in base 0 or 2–36; signs are not allowed. bitSize 0 means uint. Range errors return the maximum representable value and an error. Expected stdout: '255 <nil>\n'.
Formal Syntax & Structure
go syntaxgo
func ParseUint(s string, base int, bitSize int) (uint64, error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text to parse, inspect or quote. |
| base | int | Radix 2–36; parsing also accepts 0 to infer the radix. |
| bitSize | int | Required integer width in bits; 0 selects native int/uint width. |
Return Value
(uint64, error)
Decoded or parsed value and error; inspect the error before using the result.
Working Example
Example Snippetgo
package main
import ( "fmt" "strconv")
func main() { v, e := strconv.ParseUint("ff", 16, 8) fmt.Println(v, e)}