On Tue, 12 Jun 2007 21:46:48 +0000, 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 it?  I have maybe a hundred 
> thousand numbers at a time to convert and cannot think of how to do 
> it reliably in less than a dozen lines of code. 

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
  return pNum
end formatThousands

To call it:

  put formatThousands("10000000",",")
  --> 10,000,000

Ken Ray
Sons of Thunder Software, Inc.
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to