Phaser API Documentation

  Version: 

Member of: Phaser.Utils.String

<static> Format(string, values)

Description:

Takes a string and replaces instances of markers with values in the given array. The markers take the form of %1, %2, etc. I.e.:

Format("The %1 is worth %2 gold", [ 'Sword', 500 ])

Parameters:

name type description
string string

The string containing the replacement markers.

values array

An array containing values that will replace the markers. If no value exists an empty string is inserted instead.

Returns:
Description:

The string containing replaced values.

Type:
  • string
Examples:
Since: 3.0.0
Source: src/utils/string/Format.js (Line 7)