在Go中查找将货币USD转换为K-USD
例如 1000至1,000 10000至10,000 1000000至1,000,000
到目前为止,我写这篇文章:
func Tousd(usd int) {
str := fmt.Sprintf("%v", usd)
var size= len(str)
var zone []int
for {
size = size - 3
zone = append(zone, size)
if size <= 3 {
break
}
}
var out string
out = str
_ = out
var bs = []byte(str)
// 1 000 000
for _, element := range zone {
original := bs[element]
char := bs
char[element] = ','
char[element - 1] = original
_ = char
}
}