mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-24 09:08:13 +02:00
4d8bbcc74d
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@165421 c90b9560-bf6c-de11-be94-00142212c4b1
122 lines
3.8 KiB
XML
122 lines
3.8 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.14 $ -->
|
|
<!-- EN-Revision: 1.7 Maintainer: didou Status: ready -->
|
|
<refentry id="function.trim">
|
|
<refnamediv>
|
|
<refname>trim</refname>
|
|
<refpurpose>
|
|
Supprime les espaces en début et fin de chaîne
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>trim</methodname>
|
|
<methodparam><type>string</type><parameter>str</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>charlist</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>trim</function> retourne la chaîne <parameter>str</parameter>, après
|
|
avoir supprimé les caractères invisibles en début et fin de chaîne.
|
|
Si le second paramètre <parameter>charlist</parameter> a été omis,
|
|
<function>trim</function> supprimera les caractères suivants :
|
|
<!-- sorted by importance. Printed 3 times: trim, ltrim, rtrim -->
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
"<literal> </literal>" (<acronym>ASCII</acronym> <literal>32</literal>
|
|
(<literal>0x20</literal>)), un espace ordinaire.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
"<literal>\t</literal>" (<acronym>ASCII</acronym> <literal>9</literal>
|
|
(<literal>0x09</literal>)), une tabulation.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
"<literal>\n</literal>" (<acronym>ASCII</acronym> <literal>10</literal>
|
|
(<literal>0x0A</literal>)), une nouvelle ligne (<literal>line feed</literal>).
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
"<literal>\r</literal>" (<acronym>ASCII</acronym> <literal>13</literal>
|
|
(<literal>0x0D</literal>)), un retour chariot (<literal>carriage return</literal>).
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
"<literal>\0</literal>" (<acronym>ASCII</acronym> &zero;
|
|
(<literal>0x00</literal>)), le caractère <literal>NUL</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara> <!-- not \v, since not supported by PHP -->
|
|
"\x0B" (<acronym>ASCII</acronym> <literal>11</literal>
|
|
(<literal>0x0B</literal>)), une tabulation verticale.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
<para>
|
|
Il est aussi possible de spécifier les caractères à
|
|
supprimer en utilisant le paramètre <parameter>charlist</parameter>.
|
|
Listez simplement les caractères que vous voulez supprimer dans
|
|
ce paramètre. Avec <literal>..</literal>, vous pourrez spécifier
|
|
des intervalles de caractères.
|
|
</para>
|
|
<example>
|
|
<title>Exemple avec <function>trim</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$text = "\t\tVoici quelques mots :) ... ";
|
|
|
|
echo trim($text); // "Voici quelques mots :) ..."
|
|
echo trim($text, " \t."); // "Voici quelques mots :)"
|
|
|
|
// supprime tous les caractères de contrôle ASCII au début de la chaîne de caractères.
|
|
// (de 0 à 31 inclus)
|
|
$clean = trim($binary, "\x00..\x1F");
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<note>
|
|
<simpara>
|
|
Le second paramètre a été ajouté en &php; 4.1.0.
|
|
</simpara>
|
|
</note>
|
|
<para>
|
|
Voir aussi
|
|
<function>ltrim</function> et
|
|
<function>rtrim</function>.
|
|
</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:"../../../../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
|
|
-->
|