Attention

TYPO3 v9 has reached its end-of-life September 30th, 2021 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.

You can order Extended Long Term Support (ELTS) here: TYPO3 ELTS.

format.printf

A view helper 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 =

<code title="Scientific notation"> <f:format.printf arguments="{number: 362525200}">%.3e</f:format.printf> </code> <output> 3.625e+8 </output>

<code title="Argument swapping"> <f:format.printf arguments="{0: 3, 1: 'Kasper'}">%2$s is great, TYPO%1$d too. Yes, TYPO%1$d is great and so is %2$s!</f:format.printf> </code> <output> Kasper is great, TYPO3 too. Yes, TYPO3 is great and so is Kasper! </output>

<code title="Single argument"> <f:format.printf arguments="{1: 'TYPO3'}">We love %s</f:format.printf> </code> <output> We love TYPO3 </output>

<code title="Inline notation"> {someText -> f:format.printf(arguments: {1: 'TYPO3'})} </code> <output> We love TYPO3 </output>

Arguments

value

DataType

string

Required

false

Description

String to format

arguments

DataType

mixed

Default

array ()

Required

false

Description

The arguments for vsprintf