ACF Library

NumFormatDec

Back to List

Description: Format number with 1000 group separator and variable number of decimals

FileMaker Prototype:

Set Variable [$res; ACFU_NumFormatDec( float_num;  string_comma;  int_NumDec)]

Category: BOOTSTRAP

NOTE: The bootstrap library comes preloaded in the plugin. Read more

Function source:

function NumFormatDec  ( float num, string comma, int NumDec ) 
   functionID 237; 
   string sNum; 
   int h = num;
   int d = (num - float(h))*10.0^NumDec; 
   sNum = regex_replace ( "\d{1,3}(?=(\d{3})+(?!\d))", string(h), "$& ");
   sNum += comma + string(d); 
   
   return sNum ;  
   
end

The NumFormatDec function is similar to the NumFormat function, except it has a third parameter: number of decimals.

Example

Set Variable [$res; ACFU_NumFormatDec( 30254.557;  ".";  1)]
=> 30 257.6
Back to List