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@338024 c90b9560-bf6c-de11-be94-00142212c4b1
194 lines
5.5 KiB
XML
194 lines
5.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 7e3e160e1b425ff62990223703f3ba349811f87e Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strcspn">
|
|
<refnamediv>
|
|
<refname>strcspn</refname>
|
|
<refpurpose>Averiguar la longitud del segmento inicial que no coincida con una máscara</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>strcspn</methodname>
|
|
<methodparam><type>string</type><parameter>subject</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>mask</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>start</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Devuelve la longitud del segmento inicial de
|
|
<parameter>subject</parameter>, el cual <emphasis>no</emphasis>
|
|
contiene ningún caracter de <parameter>mask</parameter>.
|
|
</para>
|
|
<para>
|
|
Si se omiten <parameter>start</parameter> y <parameter>length</parameter>,
|
|
se examinará <parameter>subject</parameter> al
|
|
completo. Si se incluyen, el efecto será el mismo que
|
|
una llamada a <literal>strcspn(substr($subject, $start, $length),
|
|
$mask)</literal> (véase <xref linkend="function.substr" />
|
|
para más información).
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>subject</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El string a examinar.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>mask</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El string que contiene cada caracter no permitido.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>start</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La posición en <parameter>subject</parameter> donde
|
|
comenzar la búsqueda.
|
|
</para>
|
|
<para>
|
|
Si se proporciona <parameter>start</parameter> y no es negativo,
|
|
<function>strcspn</function> comenzará a
|
|
examinar <parameter>subject</parameter> en
|
|
la posición <parameter>start</parameter>-ésima. Por ejemplo, en
|
|
el '<literal>abcdef</literal>', el caracter en la
|
|
posición <literal>0</literal> es '<literal>a</literal>', el
|
|
caracter en la posición <literal>2</literal> es
|
|
'<literal>c</literal>', etc.
|
|
</para>
|
|
<para>
|
|
Si se proporciona <parameter>start</parameter> y es negativo,
|
|
<function>strcspn</function> comenzará a
|
|
examinar <parameter>subject</parameter> en
|
|
la <parameter>start</parameter>-ésima a partir del final
|
|
de <parameter>subject</parameter>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>length</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La longitud del segmento de <parameter>subject</parameter>
|
|
a examinar.
|
|
</para>
|
|
<para>
|
|
Si se proporcina <parameter>length</parameter> y no es negativo,
|
|
<parameter>subject</parameter> será examinado
|
|
desde <parameter>length</parameter> caracteres después de la
|
|
posición inicial.
|
|
</para>
|
|
<para>
|
|
Si se proporcina <parameter>length</parameter> y es negativo,
|
|
<parameter>subject</parameter> será examinado desde la
|
|
posición inicial hasta <parameter>length</parameter>
|
|
caracteres a partir del final de <parameter>subject</parameter>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve la longitud del segmento inicial de <parameter>subject</parameter>,
|
|
el cual consiste en todos los caracteres <emphasis>no</emphasis> presentes en <parameter>mask</parameter>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Cuando se establece el parámetro <parameter>start</parameter>, la longitud devuelta
|
|
se cuenta a partir de esta posición, no desde el comienzo de
|
|
<parameter>subject</parameter>.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example xml:id="strcspn.example">
|
|
<title>Ejemplo de <function>strcspn</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$a = strcspn('abcd', 'apple');
|
|
$b = strcspn('abcd', 'banana');
|
|
$c = strcspn('hello', 'l');
|
|
$d = strcspn('hello', 'world');
|
|
$e = strcspn('abcdhelloabcd', 'abcd', -9);
|
|
$f = strcspn('abcdhelloabcd', 'abcd', -9, -5);
|
|
|
|
var_dump($a);
|
|
var_dump($b);
|
|
var_dump($c);
|
|
var_dump($d);
|
|
var_dump($e);
|
|
var_dump($f);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
int(0)
|
|
int(0)
|
|
int(2)
|
|
int(2)
|
|
int(5)
|
|
int(4)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
¬e.bin-safe;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>strspn</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
|
|
-->
|