format

returns the formatted number as a string

string format(number value, [object config] );
valuenumberthe number which needs formatting
configobjectan object of formatting configuration options
stringthe formatted number in the string format
Details

The config object can contain the following attributes:

  • decimalSize - the number of decimal digits in the float number. By default, 2
  • groupSize - the number of digits in a group. By default, 3
  • decimalDelimiter - a char which separates the decimal part in the float number. By default, "."
  • groupDelimiter - a char which separates groups of digits. By default, ","
  • decimalOptional - boolean. If true, allows you not to specify the number of decimal digits in the float number
  • prefix - string. Adds prefix to the formatted number
  • sufix - string. Adds suffix to the formatted number
  • minusPosition - string. The position of a negative sign
  • minusSign - string|array. A sign for a negative number
  • priceTemplate - string. A template for specifying the price format for locales different from the default one. For the default locale it is handy to use the priceFormat method
const str1 = webix.Number.format(-10008.999, {
    decimalSize: 2, groupSize: 3, 
    decimalDelimiter: ".", groupDelimiter: "'", 
    prefix: "abc", sufix: "dfg", 
    minusPosition:"after",
    minusSign:"-",
    priceTemplate:"${obj}"
});
// ->"abc$10'009.00-dfg"
See also
Back to top