You could also just the integers themselves as keys.

 

John

    John Souvestre - New Orleans LA

 

From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On 
Behalf Of Chun Zhang
Sent: 2017 November 05, Sun 15:09
To: golang-nuts
Subject: [go-nuts] Converting uint to string

 

Hi, All, 

 

I have a group of integers ranging from 1 to 2^32 that are in the format of 
uint32. I know strconv.Itoa(i) or strconv.FormatUint(i) can definitely give 
unique representation of each number. So, I can use it as the index of a 
map[string]interface{}.

 

However, I am wondering if I use string(i) only, will I get any two numbers the 
same string representation? My guess is no, but would like to get some comments 
from you experts.

 

Also, will string(i) be faster than strconv.Itoa or strcov.FormatUInt?

 

 

 

Thanks,

Chun

 

 

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to