04-05-2007, 11:19 AM
member function str.Format100
double needs to be implemented.
function [VARIANT'numberstring] [$delimiter];;1245657864 "."
;Formats numberstring 1245657864 to 1.245.657.864
;Default: itself.
;delimiter default is '.'
;!!! NOT implemented: check for double !!!
;EXAMPLES
;str s
;s.Format100("1245657864")
;s=1245657864
;s.Format100
;s.Format100(252545 ",")
;out s
if(!numberstring) numberstring=this;else this=numberstring
if(!delimiter) delimiter="."
ARRAY(int) h.create(3)
h[0] = 9
h[1] = 6
h[2] = 3
if this.len>=10
,this.insert(delimiter this.len-h[0])
,this.insert(delimiter this.len-h[1])
,this.insert(delimiter this.len-h[2])
else if this.len>=7
,this.insert(delimiter this.len-h[1])
,this.insert(delimiter this.len-h[2])
else if this.len>=4
,this.insert(delimiter this.len-h[2])
double needs to be implemented.