cvs: phpdoc-fr /reference/strings/functions str-split.xml strripos.xml

From: Date: Wed, 28 May 2003 11:02:24 +0000
Subject: cvs: phpdoc-fr /reference/strings/functions str-split.xml strripos.xml
Groups: php.doc.fr 
Request: Send a blank email to doc-fr+get-440@lists.php.net to get a copy of this message
didou Wed May 28 07:02:24 2003 EDT Added files: /phpdoc-fr/reference/strings/functions str-split.xml strripos.xml Log: translation Index: phpdoc-fr/reference/strings/functions/str-split.xml +++ phpdoc-fr/reference/strings/functions/str-split.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.str-split"> <refnamediv> <refname>str_split</refname> <refpurpose> Convertit une cha&icirc;ne de caract&egrave;res en tableau </refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>array</type><methodname>str_split</methodname> <methodparam><type>string</type><parameter>string</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>split_length</parameter></methodparam> </methodsynopsis> <para> Convertit une cha&icirc;ne de caract&egrave;res en tableau. Si le param&egrave;tre optionel <parameter>split_length</parameter> est sp&eacute;cifi&eacute;, le tableau retourn&eacute; sera d&eacute;coup&eacute; en sous-parties, chacune de taille <parameter>split_length</parameter>, sinon, chaque sous-partie aura une taille d'un caract&egrave;re. </para> <para> &false; est retourn&eacute; si <parameter>split_length</parameter> est inf&eacute;rieur &agrave; 1. Si la longueur de <parameter>split_length</parameter> est sup&eacute;rieure &agrave; celle de <parameter>string</parameter>, la cha&icirc;ne enti&egrave;re est retourn&eacute;e dans le premier (et seul) &eacute;l&eacute;ment du tableau. </para> <para> <example> <title>Exemples d'utilisation de <function>str_split</function></title> <programlisting role="php"> <![CDATA[ <?php $str = "Salut Dave"; $arr1 = str_split($str); $arr2 = str_split($str, 3); print_r($arr1); print_r($arr2); /* L'affichage donnera : Array ( [0] => S [1] => a [2] => l [3] => u [4] => t [5] => [6] => D [7] => a [8] => v [9] => e ) Array ( [0] => Sal [1] => ut [2] => Dav [3] => e ) */ ?> ]]> </programlisting> </example> </para> <para> <example> <title>Exemples li&eacute;s &agrave; <function>str_split</function></title> <programlisting role="php"> <![CDATA[ <?php $str = "Salut Dave"; print $str{0}; // S print $str{8}; // v // Cr&eacute;e : array('S','a','l','u','t',' ','D','a','v','e') $arr1 = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); ?> ]]> </programlisting> </example> </para> <para> Voir aussi <function>preg_split</function>, <function>split</function>, <function>count_chars</function>, <function>str_word_count</function> et <link linkend="control-structures.for">for</link>. </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 --> Index: phpdoc-fr/reference/strings/functions/strripos.xml +++ phpdoc-fr/reference/strings/functions/strripos.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.strripos"> <refnamediv> <refname>strripos</refname> <refpurpose> Trouve la position de la derni&egrave;re occurence d'une cha&icirc;ne dans une autre de fa&ccedil;on insensible &agrave; la casse. </refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>strripos</methodname> <methodparam><type>string</type><parameter>haystack</parameter></methodparam> <methodparam><type>string</type><parameter>needle</parameter></methodparam> </methodsynopsis> <para> Retourne la position num&eacute;rique de la derni&egrave;re occurence de <parameter>needle</parameter> dans la cha&icirc;ne de caract&egrave;res <parameter>haystack</parameter>. Contrairement &agrave; <function>strrpos</function>, <function>strripos</function> est insensible &agrave; la casse. Notez aussi que les positions dans les cha&icirc;nes commencent &agrave; 0, et non &agrave; 1. </para> <para> Si <parameter>needle</parameter> n'est pas trouv&eacute;, la fonction retourne &false;. </para> &return.falseproblem; <para> <example> <title>Un exemple simple avec <function>strripos</function></title> <programlisting role="php"> <![CDATA[ <?php $haystack = 'ababcd'; $needle = 'aB'; $pos = strripos($haystack, $needle); if ($pos === false) { echo "D&eacute;sol&eacute;, impossible de trouver ($needle) dans ($haystack)"; } else { echo "F&eacute;licitations !\n"; echo "Nous avons trouv&eacute; le dernier ($needle) dans ($haystack) &agrave; la position ($pos)"; } /* Outputs: F&eacute;licitations ! Nous avons trouv&eacute; le dernier (aB) dans (ababcd) &agrave; la position (2) */ ?> ]]> </programlisting> </example> </para> <para> Voir aussi <function>strrpos</function>, <function>strrchr</function>, <function>substr</function> et <function>stristr</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 -->

« previous php.doc.fr (#440) next »