Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert "Double" to formatted string in VBScript

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# with Double.ToString("0.##"); is there any methode like that in VBScript ..
Please help ..

Himanshu

like image 973
Hippo Avatar asked Jul 08 '26 21:07

Hippo


1 Answers

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

like image 71
dpmattingly Avatar answered Jul 11 '26 10:07

dpmattingly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!