Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Format str $0.00
#1
I would like to know how to format a string to show the 2 decimal places in a dollar amount.

I figure it has to do with this from the QM help:

Format Fields
Syntax
%[flags][width][.precision][h|l|I64|L]type

I have know clue how to work with this though...or maybe I'm just on the wrong trail.

Thanks again!
Jimmy Vig
#2
Macro
Code:
Copy      Help
double m=1234.5678
str s
s.format("$%.2f" m)
out s
#3
Also, for currency.

Macro
Code:
Copy      Help
CURRENCY c1="$1234.5678"
c1.round(c1 2)
str s
s=c1
s.format("$%s" s)
out s
Taking on Quick Macros one day at a time


Forum Jump:


Users browsing this thread: 1 Guest(s)