I looked at USING, but there does not seem to be a way to do a floating dollar sign. What I want is:
value = 500, I get bbbb$500, where b = blanks, so value = 1000, I get bb$1,000.
Thanks,
Bill
Justification
To left justify the output in the field use a minus sign (-) as a leading character.
PRINT USING("-#### -####", 55, 88)
PRINT USING("$#### $####", 55, 88)
will float the $ to the left
just make sue you have enough # for your max number
you can also put commas in for thousands,etc..
LarryMc
There was a bug in Using() that I don't think Paul ever fixed. Some numbers do not line up properly in, say, a list box.
Code I am using:
t1 = USING("$#####,###",boxsel)
Output it gives me:
$ 1 for 1
$ 1,000 for 1000
What I want is $1 and $1,000.
Bill
I use this:
Sub AmountToDollars(float fAmount), string
'_________________________________________________________________________________________________________________
'
' Purpose: take a float and return a currency string
' Parameters: the amount
' Returns: the string
' Notes: there is curently an EBasic bug is Using() which misaligns output that has commas
'
Def result as string
Select true
Case fAmount < 1000
result = Using("%f$#,#########", fAmount)
Case fAmount < 1000000
result = Using("%f$#,########", fAmount)
Default
result = Using("%f$#,#######", fAmount)
EndSelect
Return result
EndSub
The following does pretty close to what I was looking for, just need to check length and add blanks in front:
string rtn ="Z"
int i=15000
rtn = "$" + ltrim$(Using("###,######", i))
print rtn
Bill