SPRINTF — Formats a string



Formats a variable or set of variables according to a format string.

The most common case for the use of SPRINTF is to zero-pad a number to a certain length:

; Returns 00123
exten => 123,1,Set(padfive=${SPRINTF(%05d,${EXTEN})})  

Most of the format options listed in the manpage for sprintf(3) are also implemented in this dialplan function.

See Also


Get Asterisk: The Future of Telephony, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.