Skip to main content

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. Returns null if template is null.

Examples

Example 1: Basic String Formatting

Output:

Example 2: Dynamic Query Messages

Example 3: Building URLs or Paths

Output:

Notes

  • Returns null if template is null
  • 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

Frequently Asked Questions

Placeholders are zero-indexed: {0} is replaced by the first element, {1} by the second, and so on.
Yes. The same placeholder (e.g., {0}) can appear multiple times in the template and will be replaced with the same value each time.