开发者

How to convert "Double" to formatted string in VBScript

开发者 https://www.devze.com 2023-03-12 12:23 出处:网络
I was working on small script in VB. I need to format a double number which is result of division. Thus there could be many digits after decimal places. I need to convert it to String with only two

I was working on small script in VB. I need to format a double number which is result of division. Thus there could be many digits after decimal places. I need to convert it to String with only two decimals places. I used to do it in C#开发者_JAVA技巧 with Double.ToString("0.##"); is there any methode like that in VBScript ..

Please help ..

Himanshu


You're going to want the FormatNumber function. FormatNumber(num, 2) will give you the number formatted to 2 decimal points. See the link for more details.

http://www.w3schools.com/vbscript/func_formatnumber.asp

0

精彩评论

暂无评论...
验证码 换一张
取 消