ArxBzFhblxphS Posted January 31, 2010 Share Posted January 31, 2010 (edited) Edited February 5, 2010 by Thanubis Link to comment Share on other sites More sharing options...
Malkey Posted January 31, 2010 Share Posted January 31, 2010 (edited) 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 January 31, 2010 by Malkey Link to comment Share on other sites More sharing options...
Bowmore Posted January 31, 2010 Share Posted January 31, 2010 (edited) 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 Edited January 31, 2010 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now