Java Double到String转换而不进行格式化 [英] Java Double to String conversion without formatting
问题描述
我的号码是654987.它是一个数据库中的一个ID。我想把它转换成一个字符串。
常规的Double.ToString(值)使其成为科学的形式,6.54987E5。我不想要的东西。
I have the number 654987. Its an ID in a database. I want to convert it to a string. The regular Double.ToString(value) makes it into scientific form, 6.54987E5. Something I dont want.
其他格式化功能Ive发现检查当前区域设置,并添加适当的千个分隔符等。自从它的ID,我根本不能接受任何格式。
Other formatting functions Ive found checks the current locale and adds appropriate thousand separators and such. Since its an ID, I cant accept any formatting at all.
如何做?
澄清:我在一个特殊的数据库上处理所有的数字列双打。 Double是我可以从数据库检索的唯一的(数字)类型。
To clarify: Im working on a special database that treats all numeric columns as doubles. Double is the only (numeric) type I can retrieve from the database.
推荐答案
long id = 654987;
String str = Long.toString(id);
这篇关于Java Double到String转换而不进行格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!