-
i'm trying to get a dynamic text box to display a price, ie "$ 3.50"
the variable is added to or subtracted from, so sometimes its a whole number, in which case i need it to show the zero cents. I tried the C way of dividing by 1.00 or multiplying by 1.00, but no dice. Math.round didn't help either, so I'm always stuck with integers or only the ".5"
is there any way to set the variable or the text box to 2 decimal precision?
-
ism
value is the initial value, result is the formatted output.
Code:
d = int(value*100);
decimal = substring(d, length(d)-1, -1);
integer = int(value);
result = integer+"."+decimal;
hope this helps
BlinkOk
-
i guess it came down to puttin two parts together =P
thx very much =)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|