mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 16:32:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@337034 c90b9560-bf6c-de11-be94-00142212c4b1
182 lines
4.4 KiB
XML
182 lines
4.4 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: a8eb6731a741cba4ab4772da31359239e3e147c9 Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.wordwrap">
|
|
<refnamediv>
|
|
<refname>wordwrap</refname>
|
|
<refpurpose>Ajusta un string hasta un número dado de caracteres</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>wordwrap</methodname>
|
|
<methodparam><type>string</type><parameter>str</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</parameter><initializer>false</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Ajusta un string hasta un número dado de caracteres utilizando un caracter
|
|
de salto de string.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>str</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El string de entrada.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>width</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El número de caracteres en el cual el string se verá envuelto.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>break</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La línea se rompe utilizando el parámetro
|
|
opcional <parameter>break</parameter>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>cut</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si <parameter>cut</parameter> se establece en &true;, el string siempre
|
|
será ajustado en o antes del <parameter>width</parameter> especificado. De tal forma que si se tiene
|
|
una palabra que es más larga que el ancho dado, será dividida
|
|
(ver segundo ejemplo). Cuando es &false; la función no divide la palabra
|
|
incluso si <parameter>width</parameter> es menor que el ancho de la palabra.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve el string dado ajustado a la longitud especificada.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>wordwrap</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$text = "The quick brown fox jumped over the lazy dog.";
|
|
$newtext = wordwrap($text, 20, "<br />\n");
|
|
|
|
echo $newtext;
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
The quick brown fox<br />
|
|
jumped over the lazy<br />
|
|
dog.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
<example>
|
|
<title>Ejemplo de <function>wordwrap</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$text = "A very long woooooooooooord.";
|
|
$newtext = wordwrap($text, 8, "\n", true);
|
|
|
|
echo "$newtext\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
A very
|
|
long
|
|
wooooooo
|
|
ooooord.
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
<example>
|
|
<title>Ejemplo de <function>wordwrap</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$texto = "A very long woooooooooooooooooord. and something";
|
|
$nuevo_texto = wordwrap($texto, 8, "\n", false);
|
|
|
|
echo "$nuevo_texto\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
|
|
-->
|