Jump to content
Sign in to follow this  
ArxBzFhblxphS

..

Recommended Posts

ArxBzFhblxphS
Posted Image Edited by Thanubis

Share this post


Link to post
Share on other sites
Malkey

I'm getting better at it, but I still don't fully understand StringFormat().

I know that StringFormat("%.2d", 8.8) will produce '08'.

I also know that StringFormat("%.2f", 8.8) will produce '8.80'.

What i want to know is, how do I combine the two formats to get '08.80'?

In the example "%05.2f":-

"0" means to add leading 0's to make up total number of characters ( in this case is 5 or 6);

"5" or "6" is the total number of characters including the decimal point;

".2" is the precision or number of decimal places.

MsgBox(0, "Result", ' StringFormat("%05.2f %06.2f", 8.8, 8.8) = ' & StringFormat("%05.2f %06.2f", 8.8, 8.8))
Edited by Malkey

Share this post


Link to post
Share on other sites
Bowmore

This should do it. 5 is the minimum number of characters to output including the decimal poit.

$formatted = StringFormat("%.2f", 8.8)

Edit: Too slow at typing again :D

Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.