[pmwiki-users] Formatting numbers

Dominique Faure dominique.faure at gmail.com
Fri Jan 23 04:49:59 CST 2009


On Sun, Jan 18, 2009 at 04:27, Marcus <prima at wordit.com> wrote:
> Is there a way to format numbers?
> If I have a form variable "1.5", is there a way to add a zero *only*
> if the variable has one digit after the decimal point?
>
> 1.5 becomes 1.50
> 1.54 stays as 1.54
>

Hi,

The http://www.pmwiki.org/wiki/Cookbook/MarkupExprPlus recipe offers
the 'sprintf' function which could be used as:

{(sprintf "%1.2f" 1.5)}

Regards,
Dominique



More information about the pmwiki-users mailing list