nl_tokens: * @method format ( [ place ] = 0 [ thousands ] = [ decimal ] = . ) @returns String @short Formats the number to a readable string . @extra If [ place ] is %undefined% will automatically determine the place . [ thousands ] is the character used for the thousands separator . [ decimal ] is the character used for the decimal point . @example
pl_tokens: function ( place , thousands , decimal ) { var i , str , split , integer , fraction , result = '' ; if ( isUndefined ( thousands ) ) { thousands = ',' ; } if ( isUndefined ( decimal ) ) { decimal = '.' ; } str = ( isNumber ( place ) ? round ( this , place || 0 ) . toFixed ( math . max ( place , 0 ) ) : this . toString ( ) ) . replace ( / ^- / , '' ) ; split = str . split ( '.' ) ; integer = split [ 0 ] ; fraction = split [ 1 ] ; for ( i = integer . <mask> ; i > 0 ; i -= 3 ) { if ( i < integer . length ) { result = thousands + result ; } result = integer . slice ( math . max ( 0 , i - 3 ) , i ) + result ; } if ( fraction ) { result += decimal + repeatString ( ( place || 0 ) - fraction . length , '0' ) + fraction ; } return ( this < 0 ? '-' : '' ) + result ; }