Hi Team,
I want to convert below 32 digit number into String Value using Go.
01000111000111111111111100011001
is there any method available for this?
Thanks,
Rajapandian.B
Hi Team,
I want to convert below 32 digit number into String Value using Go.
01000111000111111111111100011001
is there any method available for this?
Thanks,
Rajapandian.B
What is the expected result? Which encoding is used?
Same value only. I need 32 digit as String and I will do some split operation.
So you expect this?
"01000111000111111111111100011001"
Yes
How does 01000111000111111111111100011001
enter your system? It is not a valid int
. Please show us a code sample that you use to get this number.
package main
import (
"fmt"
)
func main() {
i := 1193279257
s := fmt.Sprintf("\"%b\"", i)
fmt.Println(s)
}
Output:
"1000111000111111111111100011001"
Thanks .It is working.I am trying to prepend β0β at the beginning.I want the below output
β01000111000111111111111100011001β.
i := 1193279257
s := fmt.Sprintf(""%b"", i)
fmt.Println(β0β +s)
But i am getting below output
0"1000111000111111111111100011001"
Thanks,
Rajapandian.B
Thanks.But How to call this
fmt.Sprintf("%032b\n", s)
s is having this value -1000111000111111111111100011001 .
i am getting below output
%!b(string=β1000111000111111111111100011001β)
THanks,
Raja
fmt.Sprintf("%032b\n", s)
gives you a string. It doesnβt output anything. How are you producing the output?
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.