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@337711 c90b9560-bf6c-de11-be94-00142212c4b1
132 lines
4.1 KiB
XML
132 lines
4.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 756b6457b6aff73a6c2720f057c36ac6cab2c10d Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no Maintainer: seros -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.str-pad">
|
|
<refnamediv>
|
|
<refname>str_pad</refname>
|
|
<refpurpose>Rellena un string hasta una longitud determinada con otro string</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>str_pad</methodname>
|
|
<methodparam><type>string</type><parameter>input</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>pad_length</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>pad_string</parameter><initializer>" "</initializer></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>pad_type</parameter><initializer>STR_PAD_RIGHT</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Esta función devuelve el string <parameter>input</parameter>
|
|
rellenado por la izquierda, la derecha, o en ambos lados hasta la longitud
|
|
especificada. Si el argumento opcional
|
|
<parameter>pad_string</parameter> no se suministra, el
|
|
<parameter>input</parameter> se rellena con espacios, de lo contrario, se
|
|
rellena con los caracteres de <parameter>pad_string</parameter>
|
|
hasta el límite.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>input</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El string de entrada.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>pad_length</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La longitud del relleno. Si el valor de <parameter>pad_length</parameter> es negativo,
|
|
inferior o igual a la longitud del string de entrada, no se realizará
|
|
ningún relleno, devolviendo así <parameter>input</parameter>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>pad_string</parameter></term>
|
|
<listitem>
|
|
<note>
|
|
<para>
|
|
El <parameter>pad_string</parameter> se puede truncar si el
|
|
número necesario de caracteres de relleno no pueden ser divididos uniformemente por la
|
|
longitud de <parameter>pad_string</parameter>.
|
|
</para>
|
|
</note>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>pad_type</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El argumento opcional <parameter>pad_type</parameter> puede ser
|
|
<constant>STR_PAD_RIGHT</constant>, <constant>STR_PAD_LEFT</constant>,
|
|
o <constant>STR_PAD_BOTH</constant>. Si no se especifica
|
|
<parameter>pad_type</parameter> se asume como
|
|
<constant>STR_PAD_RIGHT</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve el string rellenado.
|
|
</para>
|
|
</refsect1>
|
|
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>str_pad</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$input = "Alien";
|
|
echo str_pad($input, 10); // produce "Alien "
|
|
echo str_pad($input, 10, "-=", STR_PAD_LEFT); // produce "-=-=-Alien"
|
|
echo str_pad($input, 10, "_", STR_PAD_BOTH); // produce "__Alien___"
|
|
echo str_pad($input, 6, "___"); // produces "Alien_"
|
|
echo str_pad($input, 3, "*"); // produces "Alien"
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</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
|
|
-->
|