RE: Formating numbers using commas?
- Posted by Don Phillips <Graebel at hotmail.com> Jul 01, 2002
- 570 views
> Any ideas or tips would be appreciated. > > Thanks! Ahh I just love these little gems. Really gives the brain a good decent workout and hones the problem solving skill set. Well (of course) I just had to poke around with it and this is what I came up with... Did not do any comparisons (speed or otherwise) to those algos already posted. -=-=-=-=-=-=-=-=- function AddCommas( atom above ) atom below sequence answer answer = {} while above do below = remainder( above, 1000 ) above = floor( above / 1000 ) if above then answer = sprintf(",%03d",{below}) & answer end if end while return( sprint(below) & answer ) end function -=-=-=-=-=-=-=-=- Enjoy! Don