How to convert int to binary string in Go

1 Answer

0 votes
package main
 
import (
    "fmt"
    "strconv"
)
 
func main() {
    i := 255
    s := strconv.FormatInt(int64(i) , 2)

    fmt.Printf("Type : %T \nValue : %v\n", s, s) 
}
 
 
 
 
/*
run:
 
Type : string 
Value : 11111111
 
*/

 



answered May 26, 2020 by avibootz

Related questions

1 answer 374 views
1 answer 280 views
1 answer 227 views
1 answer 180 views
...