.. include:: /Includes.rst.txt
.. _typo3fluid-fluid-format-printf:
=============
format.printf
=============
A ViewHelper for formatting values with printf. Either supply an array for
the arguments or a single value.
See https://www.php.net/manual/en/function.sprintf.php
Examples
========
Scientific notation
-------------------
::
%.3e
Output::
3.625e+8
Argument swapping
-----------------
::
%2$s is great, TYPO%1$d too. Yes, TYPO%1$d is great and so is %2$s!
Output::
Kasper is great, TYPO3 too. Yes, TYPO3 is great and so is Kasper!
Single argument
---------------
::
We love %s
Output::
We love TYPO3
Inline notation
---------------
::
{someText -> f:format.printf(arguments: {1: 'TYPO3'})}
Output::
We love TYPO3
Arguments
=========
.. _format.printf_value:
value
-----
:aspect:`DataType`
string
:aspect:`Required`
false
:aspect:`Description`
String to format
.. _format.printf_arguments:
arguments
---------
:aspect:`DataType`
mixed
:aspect:`Default`
array ()
:aspect:`Required`
false
:aspect:`Description`
The arguments for vsprintf