# string.format

Function · category: Other

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/core/string.js#L137

```ts
format(s: string, ...args: any[]): string
```

Return a string with {n} replaced with the n-th argument.

**Parameters**

- `s` (`string`): The string to format.
- `args` (`any[]`): All other arguments are substituted into the string.

**Returns** `string`: The formatted string.

**Example**

```ts
const s = string.format("Hello {0}", "world");
console.log(s); // Prints "Hello world"
```
