Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 1 | ``format`` |
2 | ========== | ||||
3 | |||||
4 | The ``format`` filter formats a given string by replacing the placeholders | ||||
5 | (placeholders follows the `sprintf`_ notation): | ||||
6 | |||||
7 | .. code-block:: twig | ||||
8 | |||||
9 | {{ "I like %s and %s."|format(foo, "bar") }} | ||||
10 | |||||
11 | {# outputs I like foo and bar | ||||
12 | if the foo parameter equals to the foo string. #} | ||||
13 | |||||
14 | .. seealso:: | ||||
15 | |||||
16 | :doc:`replace<replace>` | ||||
17 | |||||
18 | .. _`sprintf`: https://secure.php.net/sprintf |