mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-24 17:02:18 +01:00
216 lines
5.4 KiB
XML
216 lines
5.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: a6ee935b0e0416084509e2c82ecea0578c7f40cc Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="function.wordwrap" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>wordwrap</refname>
|
|
<refpurpose>Effectue la césure d'une chaîne</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>wordwrap</methodname>
|
|
<methodparam><type>string</type><parameter>string</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>width</parameter><initializer>75</initializer></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>break</parameter><initializer>"\n"</initializer></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>cut_long_words</parameter><initializer>&false;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Effectue la césure d'une chaîne.
|
|
Les chaînes se terminent après un caractère d'espace (U+0020) à moins que <parameter>cut_long_words</parameter>
|
|
ne soit défini sur &true;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>string</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La chaîne d'entrée.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>width</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le nombre de caractères à partir duquel la chaîne sera coupée.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>break</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La ligne est rompue en utilisant <parameter>break</parameter> ce paramètre optionnel.
|
|
Cela ne doit pas être une chaîne vide.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>cut_long_words</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si le paramètre <parameter>cut_long_words</parameter> vaut &true;, la césure de
|
|
la chaîne sera toujours à la taille <parameter>width</parameter> ou avant.
|
|
Si vous avez un mot qui est plus long que la taille de césure, il sera
|
|
coupé en morceaux : voir le second exemple. Lorsque vaut &false;,
|
|
la fonction ne va pas couper le mot, même si le paramètre
|
|
<parameter>width</parameter> est plus petit que la taille du mot.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne la chaîne fournie coupée à la longueur spécifiée.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<simpara>
|
|
Si <parameter>break</parameter> est une chaîne vide, une <classname>ValueError</classname> est levée.
|
|
</simpara>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
Si <parameter>break</parameter> est une chaîne vide,
|
|
une <classname>ValueError</classname> est levée;
|
|
auparavant, dans ce cas, cela émettait un <constant>E_WARNING</constant> et retournait &false;.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>wordwrap</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$text = "Portez ce vieux whisky au juge blond qui fume.";
|
|
$newtext = wordwrap($text, 20, "<br />\n");
|
|
|
|
echo $newtext;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Portez ce vieux<br />
|
|
whisky au juge<br />
|
|
blond qui fume.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
<example>
|
|
<title>Exemple avec <function>wordwrap</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$text = "Un mot très très loooooooooooooooooong.";
|
|
$newtext = wordwrap($text, 8, "\n", true);
|
|
|
|
echo "$newtext\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Un mot
|
|
très
|
|
très
|
|
looooooo
|
|
oooooooo
|
|
ooong.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
<example>
|
|
<title>Exemple avec <function>wordwrap</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$text = "A very long woooooooooooooooooord. and something";
|
|
$newtext = wordwrap($text, 8, "\n", false);
|
|
|
|
echo "$newtext\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
A very
|
|
long
|
|
woooooooooooooooooord.
|
|
and
|
|
something
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>nl2br</function></member>
|
|
<member><function>chunk_split</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- 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:"~/.phpdoc/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
|
|
-->
|