Jump to content

Non-decimal radices/Convert: Difference between revisions

m (fix bare lang tag)
Line 491:
 
=={{header|Go}}==
<lang go>importpackage "strconv"main
 
import (
s := strconv.Itob(26, 16) // returns the string 1a
"fmt"
i,_ := strconv.Btoi64("1a", 16) // returns the integer 26</lang>
"math/big"
"strconv"
)
 
func main () {
s := strconv.ItobFormatInt(26, 16) // returns the string "1a"
fmt.Println(s)
 
i,_ err := strconv.Btoi64ParseInt("1a", 16, 64) // returns the integer (int64) 26</lang>
if err == nil {
fmt.Println(i)
}
b, ok := new(big.Int).SetString("1a", 16) // returns the big integer 26
if ok {
fmt.Println(b)
}
}</lang>
 
=={{header|Groovy}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.