title | page_title | description | slug | position |
---|---|---|---|---|
General Formatting |
General Formatting | Kendo UI Internationalization |
Use the formatting capabilities of the `format` and `toString` methods when working with the Kendo UI Internationalization package. |
generalformatting_internalization |
1 |
Provides methods for applying placeholder format and type independent value formatting by using the locale specific settings.
The supported types of general formatting are:
To replace the format string placeholders ({index}
) with the provided values based on the index, use the format
method. You can also set a specific format specified for Date
and Number
values by adding :format
after the index.
import { format } from '@progress/kendo-intl';
format('Date: {0:d} - Price: {1:c}', [new Date(), 10.5], "en"); // Date: 1/5/2017 - Price: $10.50
To format both the Date
and Number
values by using the locale specific settings, apply the toString
method. If you pass a string as a value, it is returned without any modification.
import { toString } from '@progress/kendo-intl';
toString(new Date(), "d", "en"); // 1/5/2017
toString(10.5, "c", "bg"); // 10,50 лв.