mirror of
https://github.com/php/doc-es.git
synced 2026-04-24 23:58:06 +02:00
97636291b1
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@300142 c90b9560-bf6c-de11-be94-00142212c4b1
162 lines
4.7 KiB
XML
162 lines
4.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: bc3a5cc7bd9d0ed1388589352f63e080a61b80d2 Maintainer: yago Status: ready -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strtr" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>strtr</refname>
|
|
<refpurpose>Traduce ciertos caracteres</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>strtr</methodname>
|
|
<methodparam><type>string</type><parameter>str</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>from</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>to</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>strtr</methodname>
|
|
<methodparam><type>string</type><parameter>str</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>replace_pairs</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Esta función devuelve una copia de la <parameter>cadena</parameter>,
|
|
traduciendo todas las apariciones de cada caracter en
|
|
<parameter>desde</parameter> por el carácter correspondiente
|
|
<parameter>hasta</parameter>.
|
|
</para>
|
|
<para> Si <parameter>desde</parameter> y <parameter>hasta</parameter> son de distinta logitud, se
|
|
ignoran los caracteres extra de la cadena más larga.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>cadena</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Tipo <type>string</type> La cadena que se está traduciendo.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>desde</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Tipo <type>string</type> sus caracteres serán reemplazado por
|
|
<parameter>hasta</parameter>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>hasta</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para> Tipo <type>string</type> los caracteres que reemplazarán a
|
|
<parameter>desde</parameter>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>pares_sustituidos</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para> El argumento <parameter>pares_sustituidos</parameter> puede ser usado como un sustituto
|
|
para <parameter>hasta</parameter> y <parameter>desde</parameter> en cuyo caso se trata de un
|
|
<type>array</type> en esta forma <literal>array('from' => 'to', ...)</literal>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve la <type>cadena</type> traducida.
|
|
</para>
|
|
<para>
|
|
Si el <parameter>replace_pairs</parameter> contiene una clave con
|
|
una <type>cadena</type> vacía (<literal>""</literal>),
|
|
se devolverá &false;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>strtr</function> ejemplo</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$addr = strtr($addr, "äåö", "aao");
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<function>strtr</function> Puede llamarse con dos unicos argumentos. Si se llama con 2 argumentos
|
|
se comporta de otro modo: <parameter>desde</parameter> debe ser entonces una matriz que contenga
|
|
pares cadena -> cadena que serán sustituídos en la cadena original. <function>strtr</function>
|
|
siempre buscará la coincidencia más larga primero y *NO* intentará sustituir nada en lo que haya
|
|
trabajado ya.
|
|
</para>
|
|
<example>
|
|
<title><function>strtr</function> ejemplo con 2 argumentos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$trans = array("hola" => "buen dia", "buen dia" => "hola");
|
|
echo strtr("hola a todos, digo buen dia", $trans);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
buen dia a todos, digo hola
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>str_replace</function></member>
|
|
<member><function>preg_replace</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
|
|
--> |