[]
Spread.Formatter.GeneralFormatter
• new GeneralFormatter(format?
, cultureName?
)
Represents a formatter with the specified format mode and format string.
Name | Type |
---|---|
format? |
string |
cultureName? |
string |
▸ format(obj
, formattedData?
): string
Formats the specified object as a string with a formatted data Object.
example
//This example uses the format method.
var formatter = new GC.Spread.Formatter.GeneralFormatter("#,##0.00");
var result = formatter.format(123456.789);
console.log(result); // '123,456.79'
Name | Type | Description |
---|---|---|
obj |
Object |
The object with cell data to format. |
formattedData? |
Object |
- |
string
The formatted string.
▸ formatString(value?
): string
| GeneralFormatter
Gets or sets the format string for this formatter.
example
//This example gets the format string.
var formatter = new GC.Spread.Formatter.GeneralFormatter("#,##0.00");
var result = formatter.formatString();
console.log(result); // '#,##0.00'
Name | Type | Description |
---|---|---|
value? |
string |
The format string for this formatter. |
string
| GeneralFormatter
If no value is set, returns the formatter string for this formatter; otherwise, returns the formatter.
▸ parse(str
): Object
Parses the specified text.
example
//This example uses the parse method.
var formatter = new GC.Spread.Formatter.GeneralFormatter("#,##0.00");
var result = formatter.parse("123,456.78");
console.log(result); // 123456.78
Name | Type |
---|---|
str |
string |
Object
The parsed object.