mirror of
https://github.com/php/doc-it.git
synced 2026-03-26 08:32:15 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@314558 c90b9560-bf6c-de11-be94-00142212c4b1
86 lines
3.1 KiB
XML
86 lines
3.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: n/a Maintainer: darvina Status: ready -->
|
|
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.26 -->
|
|
<refentry xml:id="function.str-pad" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>str_pad</refname>
|
|
<refpurpose>
|
|
Riempie una stringa con un'altra stringa portando la prima ad una lunghezza pre-determinata
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrizione</title>
|
|
<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></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>pad_type</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Questa funzione restituisce la stringa <parameter>input</parameter>
|
|
riempita per una data lunghezza a sinistra, a destra, o in entrambi i lati.
|
|
Se il parametro opzionale
|
|
<parameter>pad_string</parameter> non viene passato, l'
|
|
<parameter>input</parameter> viene completato con spazi, altrimenti viene
|
|
completato con i caratteri di <parameter>pad_string</parameter>
|
|
fino al limite.
|
|
</para>
|
|
<para>
|
|
Il parametro <parameter>pad_type</parameter>, opzionale, può valere
|
|
<constant>STR_PAD_RIGHT</constant>, <constant>STR_PAD_LEFT</constant>,
|
|
oppure <constant>STR_PAD_BOTH</constant>. Se non si indica
|
|
<parameter>pad_type</parameter> lo si assume pari a
|
|
<constant>STR_PAD_RIGHT</constant>.
|
|
</para>
|
|
<para>
|
|
Se il valore di <parameter>pad_length</parameter> è negativo oppure
|
|
minore della stringa di input, non si ha nessun completamento.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Esempio di uso di <function>str_pad</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$input = "Alien";
|
|
echo str_pad($input, 10); // produces "Alien "
|
|
echo str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien"
|
|
echo str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___"
|
|
echo str_pad($input, 6 , "___"); // produces "Alien_"
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Il parametro <parameter>pad_string</parameter> può essere troncato
|
|
se il numero di caratteri necessari al completamento non può essere diviso
|
|
per la lunghezza di <parameter>pad_string</parameter>.
|
|
</para>
|
|
</note>
|
|
</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
|
|
-->
|