1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-27 00:42:10 +01:00
Files
archived-doc-es/reference/strings/functions/stripos.xml
Pedro Antonio Gil Rodríguez 730d57dad0 Actualización a la última versión
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@336391 c90b9560-bf6c-de11-be94-00142212c4b1
2015-04-05 18:32:56 +00:00

155 lines
4.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: fba5aebcd8042b3a1880f171cab72722cceb68b2 Maintainer: seros Status: ready -->
<!-- Reviewed: yes Maintainer: seros -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.stripos">
<refnamediv>
<refname>stripos</refname>
<refpurpose>Encuentra la posición de la primera aparición de un substring en un string sin considerar mayúsculas ni minúsculas</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>stripos</methodname>
<methodparam><type>string</type><parameter>haystack</parameter></methodparam>
<methodparam><type>string</type><parameter>needle</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
Encuentra la posición numérica de la primera aparición de
<parameter>needle</parameter> (aguja) en el string <parameter>haystack</parameter> (pajar).
</para>
<para>
A diferencia de <function>strpos</function>, <function>stripos</function> no
considera las mayúsculas ni las minúsculas.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>haystack</parameter></term>
<listitem>
<para>
El string donde buscar.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>needle</parameter></term>
<listitem>
<para>
Observe que <parameter>needle</parameter> puede ser un string de uno o
más caracteres.
</para>
<para>
Si <parameter>needle</parameter> no es un string, será convertido a un valor
de tipo integer y se aplicará como el valor ordinal de un carácter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
Si se específica, la búsqueda se iniciará en éste número de caracteres contados desde
el inicio del string. A diferencia de <function>strrpos</function> y
<function>strripos</function>, offset no puede ser negativo.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Devuelve la posición donde está la aguja, en relación al inicio del
string <parameter>haystack</parameter> (independiente de offset).
Observe también que las posiciones de inicio de los string empiezan en 0, y no en 1.
</para>
<para>
Devuelve &false; si no se encontró la aguja.
</para>
&return.falseproblem;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Ejemplos de <function>stripos</function></title>
<programlisting role="php">
<![CDATA[
<?php
$findme = 'a';
$mystring1 = 'xyz';
$mystring2 = 'ABC';
$pos1 = stripos($mystring1, $findme);
$pos2 = stripos($mystring2, $findme);
// No, 'a' sin duda no está en 'xyz'
if ($pos1 === false) {
echo "El string '$findme' no se encontró en el strng '$mystring1'";
}
// Observe el uso de ===. Usar solamente == no funcionará como se espera
// debido a que la posición de 'a' es el 0º (primer) caracter.
if ($pos2 !== false) {
echo "Se encontró '$findme' en '$mystring2' en la posición $pos2";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
&note.bin-safe;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mb_stripos</function></member>
<member><function>strpos</function></member>
<member><function>strrpos</function></member>
<member><function>strripos</function></member>
<member><function>stristr</function></member>
<member><function>substr</function></member>
<member><function>str_ireplace</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
-->