本文介紹了如何打印不帶逗號(hào)的 Double的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
限時(shí)送ChatGPT賬號(hào)..
使用 toString()
時(shí),Double 添加逗號(hào)(5143 打印為 5,143).如何禁用逗號(hào)?
When using toString()
, Double adds commas (5143 is printed as 5,143).
How to disable the commas?
推薦答案
正如 Rorick 正確指出的那樣,您的問(wèn)題屬于 Locale.但是,您應(yīng)該查看 DecimalFormat類,以防萬(wàn)一更改語(yǔ)言環(huán)境意味著搞砸所有事情.
Your problem belongs to Locale, as pointed out correctly by Rorick. However, you should look into DecimalFormat class, in case changing Locale means mess up all the things.
查看 NumberFormat 類, 處理千位分隔符.因?yàn)槟那闆r似乎是關(guān)于千位分隔符.
Look at NumberFormat class, to deal with thousand separator. Because it seems your case is regarding thousand separator instead.
這篇關(guān)于如何打印不帶逗號(hào)的 Double的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!