Description
Formats a string by replacing numbered placeholders{0}, {1}, {2}, etc. with corresponding values from a parameters array. Similar to sprintf-style formatting.
Syntax
Parameters
Returns
Type: string The formatted string with placeholders replaced by parameter values. Returnsnull if template is null.
Examples
Example 1: Basic String Formatting
Example 2: Dynamic Query Messages
Example 3: Building URLs or Paths
Notes
- Returns
nullif template isnull - Placeholders are zero-indexed:
{0},{1},{2}, etc. - Same placeholder can be used multiple times in template
- Parameters are replaced in order of array index
- Useful for building dynamic messages, logs, or formatted output
See Also
- text.replace - Replace text using regex patterns
- text.join - Join array elements with delimiter
Frequently Asked Questions
How are placeholders numbered in flex.text.format?
How are placeholders numbered in flex.text.format?
Placeholders are zero-indexed:
{0} is replaced by the first element, {1} by the second, and so on.Can I reuse the same placeholder multiple times?
Can I reuse the same placeholder multiple times?
Yes. The same placeholder (e.g.,
{0}) can appear multiple times in the template and will be replaced with the same value each time.