On Tue, 12 Jun 2007 21:46:48 +, Mark E. Powell wrote:
> If there a built-in "thousandths delimit" function that takes a
> number and inserts the appropriate delimiter (e.g. commas for USA).
> Alternately, does someone have an idea for a really fast and
> efficient custom function that does
Thank you, Ken. Works like a charm.
---
Here you go - this is based on a function that Mark Wieder created:
function formatThousands pNum,pSeparator
repeat with x = length(pNum)-3 to 3 step -3
put pSeparator before char x+1 of pNum
end repeat
On 6/12/07 3:52 PM, "Mark E. Powell" <[EMAIL PROTECTED]> wrote:
> Thank you, Ken. Works like a charm.
> ---
> Here you go - this is based on a function that Mark Wieder created:
>
> function formatThousands pNum,pSeparator
> repeat with x = length(pN
Jim-
Nice. Very nice.
Ken-
Is this a candidate for inclusion in the standard library?
--
Mark Wieder
[EMAIL PROTECTED]
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage you
On Tue, 12 Jun 2007 17:08:46 -0700, Mark Wieder wrote:
> Jim-
>
> Nice. Very nice.
>
> Ken-
>
> Is this a candidate for inclusion in the standard library?
Very possibly - the Rev Standard Library is being moved to the
revInterop group so things like this can be put up for comment before
incl
Thanks for the props.
Note: the function also handles the accounting format where the "-" sign is
trailing since the decimal and beyond is held as a suffix.
Jim Ault
Las Vegas
On 6/12/07 5:08 PM, "Mark Wieder" <[EMAIL PROTECTED]> wrote:
> Jim-
>
> Nice. Very nice.
>
> Ken-
>
> Is this a cand
One thing ver (1) does not handle is the switching separator.
I should have said:
if pSeparator is "," then set the itemDel to "."
--otherwise comma will be used
...then finished with...
get (holdPrefix & pNum)
put holdDec into item 2 of it
return it
--
I will offer a slight (2)
I will add arbitrary and optional currency (£ $ YEN etc) and alternative
decimal (some countries use "." for the thousands and "," for the decimal) with
0.00 numberFormatting...
on mouseUp
put formatThousands(fld 1,"LAT",". ",",")
end mouseUp
function formatThousands pNum,pCurrency,
Hello, Hugh,
In my last script, I did accommodate the comma/period alternative by using
"itemDel" to form the result string, therefore the default itemDel for Rev
would be comma thus if pSeparator was "." just use the default of "," for
the decimal separator.
if pSeparator is "," then set the it
Hi Jim
> Of course, this is why universal functions are difficult to write. A tool
> for many purposes may become less and less convenient.
You are, of course, quite right. The usability of a function should be
proportionate to the required functionality. A currency formatter is not
ne
On 6/13/07 11:07 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
>
> Hi Jim
>
>> Of course, this is why universal functions are difficult to write. A tool
>> for many purposes may become less and less convenient.
>
> You are, of course, quite right. The usability of a function should
If you just need something for whole integers, how about something
simple like:
function thousandsDelimit pNum
repeat with i=-1 down to (0 - length(pNum))
put char i of pNum before temp
if (i mod 3 = 0) then put comma before temp
end repeat
12 matches
Mail list logo