mirror of
https://github.com/php/doc-it.git
synced 2026-04-23 23:38:18 +02:00
2d3dbd42a0
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@351144 c90b9560-bf6c-de11-be94-00142212c4b1
183 lines
4.7 KiB
XML
183 lines
4.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: 8b5940cadeb4f1c8492f4a7f70743a2be807cf39 Maintainer: pastore Status: ready -->
|
|
<!-- CREDITS: darvina -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ltrim">
|
|
<refnamediv>
|
|
<refname>ltrim</refname>
|
|
<refpurpose>Rimuove gli spazi (o altri caratteri) dall'inizio di una stringa</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>ltrim</methodname>
|
|
<methodparam><type>string</type><parameter>str</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>character_mask</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Rimuove gli spazi (o altri caratteri) dall'inizio di una stringa
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>str</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La stringa di input.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>character_mask</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Si possono anche specificare i caratteri che si vogliono eliminare, mediante il
|
|
parametro <parameter>character_mask</parameter>.
|
|
È sufficiente elencare tutti i caratteri che vogliono essere eliminati. Con
|
|
<literal>..</literal> si può specificare un intervallo di caratteri.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Questa funzione restituisce una stringa con gli spazi eliminati dall'inzio
|
|
della <parameter>str</parameter>.
|
|
Senza il secondo parametro,
|
|
<function>ltrim</function> eliminerà questi caratteri:
|
|
<!-- sorted by importance. Printed 3 times: trim, ltrim, rtrim -->
|
|
<itemizedlist>
|
|
<listitem>
|
|
<simpara>
|
|
" " (<acronym>ASCII</acronym> <literal>32</literal>
|
|
(<literal>0x20</literal>)), uno spazio ordinario.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
"\t" (<acronym>ASCII</acronym> <literal>9</literal>
|
|
(<literal>0x09</literal>)), una tabulazione.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
"\n" (<acronym>ASCII</acronym> <literal>10</literal>
|
|
(<literal>0x0A</literal>)), una nuova linea (line feed).
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
"\r" (<acronym>ASCII</acronym> <literal>13</literal>
|
|
(<literal>0x0D</literal>)), un ritorno a capo.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara>
|
|
"\0" (<acronym>ASCII</acronym> <literal>0</literal>
|
|
(<literal>0x00</literal>)), il byte <literal>NUL</literal>.
|
|
</simpara>
|
|
</listitem>
|
|
<listitem>
|
|
<simpara> <!-- not \v, since not supported by PHP -->
|
|
"\x0B" (<acronym>ASCII</acronym> <literal>11</literal>
|
|
(<literal>0x0B</literal>)), una tab verticale.
|
|
</simpara>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Esempio d'uso di <function>ltrim</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$text = "\t\tThese are a few words :) ... ";
|
|
$binary = "\x09Example string\x0A";
|
|
$hello = "Hello World";
|
|
var_dump($text, $binary, $hello);
|
|
|
|
print "\n";
|
|
|
|
|
|
$trimmed = ltrim($text);
|
|
var_dump($trimmed);
|
|
|
|
$trimmed = ltrim($text, " \t.");
|
|
var_dump($trimmed);
|
|
|
|
$trimmed = ltrim($hello, "Hdle");
|
|
var_dump($trimmed);
|
|
|
|
// elimina i caratteri di controllo ASCII all'inizio di $binary
|
|
// (da 0 a 31 compreso)
|
|
$clean = ltrim($binary, "\x00..\x1F");
|
|
var_dump($clean);
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
string(32) " These are a few words :) ... "
|
|
string(16) " Example string
|
|
"
|
|
string(11) "Hello World"
|
|
|
|
string(30) "These are a few words :) ... "
|
|
string(30) "These are a few words :) ... "
|
|
string(7) "o World"
|
|
string(15) "Example string
|
|
"
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>trim</function></member>
|
|
<member><function>rtrim</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
|
|
-->
|