aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/twig/twig/doc/filters/format.rst
blob: fe55a09e0796f94da8192c5358f3d3b67b2ee72a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
``format``
==========

The ``format`` filter formats a given string by replacing the placeholders
(placeholders follows the `sprintf`_ notation):

.. code-block:: jinja

    {{ "I like %s and %s."|format(foo, "bar") }}

    {# returns I like foo and bar
       if the foo parameter equals to the foo string. #}

.. _`sprintf`: http://www.php.net/sprintf

.. seealso:: :doc:`replace<replace>`