2004-04-13 15:43:47 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
|
<!-- $Revision$ -->
|
2004-07-04 09:39:39 +00:00
|
|
|
|
<!-- EN-Revision: 1.1 Maintainer: gerald Status: ready -->
|
2004-05-23 15:50:53 +00:00
|
|
|
|
<sect1 id="language.modifier.string.format">
|
|
|
|
|
|
<title>string_format</title>
|
|
|
|
|
|
<informaltable frame="all">
|
|
|
|
|
|
<tgroup cols="5">
|
|
|
|
|
|
<colspec colname="param" align="center" />
|
|
|
|
|
|
<colspec colname="type" align="center" />
|
|
|
|
|
|
<colspec colname="required" align="center" />
|
|
|
|
|
|
<colspec colname="default" align="center" />
|
|
|
|
|
|
<colspec colname="desc"/>
|
|
|
|
|
|
<thead>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>Position du param<61>tre</entry>
|
|
|
|
|
|
<entry>Type</entry>
|
|
|
|
|
|
<entry>Requis</entry>
|
|
|
|
|
|
<entry>Defaut</entry>
|
|
|
|
|
|
<entry>Description</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>1</entry>
|
|
|
|
|
|
<entry>cha<EFBFBD>ne de caract<63>res</entry>
|
|
|
|
|
|
<entry>Oui</entry>
|
|
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
|
|
|
|
<entry>Le format <20> utiliser (sprintf)</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</tgroup>
|
|
|
|
|
|
</informaltable>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Un moyen pour formater les cha<68>nes de caract<63>res, comme par exemple les
|
|
|
|
|
|
nombres d<>cimaux. Utilise la syntaxe de sprintf pour formater les <20>l<EFBFBD>ments.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>string_format</title>
|
2004-07-04 09:39:39 +00:00
|
|
|
|
<programlisting role="php">
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
<?php
|
2004-04-13 15:43:47 +00:00
|
|
|
|
$smarty = new Smarty;
|
2004-07-04 09:39:39 +00:00
|
|
|
|
$smarty->assign('nombre', 23.5787446);
|
|
|
|
|
|
$smarty->display('index.tpl');
|
|
|
|
|
|
?>
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
ou index.tpl est :
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
|
<![CDATA[
|
2004-04-13 15:43:47 +00:00
|
|
|
|
{$nombre}
|
|
|
|
|
|
{$nombre|string_format:"%.2f"}
|
|
|
|
|
|
{$nombre|string_format:"%d"}
|
2004-07-04 09:39:39 +00:00
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Ce qui donne en sortie :
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<screen>
|
|
|
|
|
|
<![CDATA[
|
2004-04-13 15:43:47 +00:00
|
|
|
|
23.5787446
|
|
|
|
|
|
23.58
|
2004-07-04 09:39:39 +00:00
|
|
|
|
24
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</screen>
|
2004-05-23 15:50:53 +00:00
|
|
|
|
</example>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</sect1>
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
|
|
Local variables:
|
|
|
|
|
|
mode: sgml
|
|
|
|
|
|
sgml-omittag:t
|
|
|
|
|
|
sgml-shorttag:t
|
|
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
|
|
sgml-indent-step:1
|
|
|
|
|
|
sgml-indent-data:t
|
|
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
|
|
sgml-parent-document:nil
|
|
|
|
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
|
|
End:
|
|
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
|
|
vi: ts=1 sw=1
|
2004-05-23 15:50:53 +00:00
|
|
|
|
-->
|