圆形的VBScript使用CCUR 2位小数 [英] vbscript round to 2 decimal places using Ccur

查看:179
本文介绍了圆形的VBScript使用CCUR 2位小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 CCur函数()而不是 CDbl()为回答这个问题:

I am using CCur() instead of CDbl() as answered in this question:

<一个href=\"http://stackoverflow.com/questions/13569944/vbscript-mathematical-ex$p$pssion-not-working\">vbscript数学前pression不工作

但我想显示金额小数例如3应该是3.00和3.555应该是3.55。

But I want to display amount to decimal places e.g 3 should be 3.00 and 3.555 should be 3.55.

我怎样才能做到这一点使用CCur函数()函数?

How can I achieve this using CCur() function?

推荐答案

CCur函数()是一个转换为货币的功能,而不是一个数字格式设置功能。结果

CCur() is a "Convert to Currency" function, not a number formatting function.

使用下面的函数,而不是:结果

Use following functions instead:

FormatNumber (编号[,小数位数[,IncludeLeadingZero [,UseParenthesis [,GroupDigits可]]]])结果

FormatNumber(number [,DecimalPlaces [,IncludeLeadingZero [,UseParenthesis [, GroupDigits]]]] )

或结果

FormatCurrency(Ex$p$pssion[,NumDigAfterDec[,IncLeadingDig[,UseParForNegNum[,GroupDig]]]])

FormatCurrency(Expression[,NumDigAfterDec[,IncLeadingDig[,UseParForNegNum[,GroupDig]]]])

号:格式化数字结果
小数位数:小数点后显示位数结果。
IncludeLeadingZero:包括数字℃的前导零; 1> -1结果
UseParenthesis:在Parentheis显示负数(500)= -500结果
GroupDigits可:集团大量用逗号(或区域分隔符)结果

这篇关于圆形的VBScript使用CCUR 2位小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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