我的号码是 654987.它是数据库中的一个 ID.我想将其转换为字符串.常规的 Double.ToString(value) 使其成为科学形式,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.
我发现的其他格式化函数检查当前语言环境并添加适当的千位分隔符等.由于它是一个 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.
Use Long:
long id = 654987;
String str = Long.toString(id);
这篇关于Java Double 到 String 的转换,无需格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何检测 32 位 int 上的整数溢出?How can I detect integer overflow on 32 bits int?(如何检测 32 位 int 上的整数溢出?)
return 语句之前的局部变量,这有关系吗?Local variables before return statements, does it matter?(return 语句之前的局部变量,这有关系吗?)
如何将整数转换为整数?How to convert Integer to int?(如何将整数转换为整数?)
如何在给定范围内创建一个随机打乱数字的 intHow do I create an int array with randomly shuffled numbers in a given range(如何在给定范围内创建一个随机打乱数字的 int 数组)
java的行为不一致==Inconsistent behavior on java#39;s ==(java的行为不一致==)
为什么 Java 能够将 0xff000000 存储为 int?Why is Java able to store 0xff000000 as an int?(为什么 Java 能够将 0xff000000 存储为 int?)