仅获取数字中的几个数字... [英] Getting only a few digits in a number...

查看:63
本文介绍了仅获取数字中的几个数字...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我试图弄清楚如何只获取小数点后的两个数字.就像,我想要1.17,我得到1.1730213 ...我怎么能得到那么多数字?而且我也不想只显示有效数字...如果我得到1024.02,我希望它显示为1024.02.

如果需要更好的措辞,请让我知道...

Ok, I''m trying to figure out how to only get the two numbers after a decimal point. Like, I want 1.17, and I get 1.1730213... How can I get just that many digits? And I don''t want just significant digits, either... If I get 1024.02, I want it to show as 1024.02.

If I need to word this better, please let me know...

推荐答案

您正在寻找String.Format函数.

然后,此页面(自定义数字格式字符串 [
You''re looking for the String.Format function.

Then, this page (Custom Numeric Format Strings[^]) shows you what to put in as the format.


这篇关于仅获取数字中的几个数字...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆