简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM