本文介紹了如何打印不帶逗號的 Double的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
使用 toString()
時,Double 添加逗號(5143 打印為 5,143).如何禁用逗號?
When using toString()
, Double adds commas (5143 is printed as 5,143).
How to disable the commas?
推薦答案
正如 Rorick 正確指出的那樣,您的問題屬于 Locale.但是,您應該查看 DecimalFormat類,以防萬一更改語言環境意味著搞砸所有事情.
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 類, 處理千位分隔符.因為您的情況似乎是關于千位分隔符.
Look at NumberFormat class, to deal with thousand separator. Because it seems your case is regarding thousand separator instead.
這篇關于如何打印不帶逗號的 Double的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!