http://golang.org/pkg/strconv/http://play.golang.org/p/4VNRgW8WoB如何將浮點(diǎn)數(shù)轉(zhuǎn)換為字符串格式?這是谷歌游樂(lè)場(chǎng),但沒(méi)有得到預(yù)期的輸出。(2e+07) 我想得到“21312421.213123”package mainimport "fmt"import "strconv"func floattostr(input_num float64) string { // to convert a float number to a string return strconv.FormatFloat(input_num, 'g', 1, 64) } func main() { fmt.Println(floattostr(21312421.213123)) // what I expect is "21312421.213123" in string format }請(qǐng)幫我從浮點(diǎn)數(shù)中取出字符串。謝謝
- 1 回答
- 0 關(guān)注
- 285 瀏覽
添加回答
舉報(bào)
0/150
提交
取消