-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathstripos.xml
More file actions
204 lines (192 loc) · 5.72 KB
/
stripos.xml
File metadata and controls
204 lines (192 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 4b72b23513caa3a8bc520d459a0417defc7b3880 Maintainer: PhilDaiguille Status: ready -->
<!-- Reviewed: no Maintainer: Marqitos -->
<refentry xml:id="function.stripos" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>stripos</refname>
<refpurpose>Busca la posición de la primera ocurrencia en un string, sin distinguir mayúsculas de minúsculas</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>int</type><type>false</type></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>
Busca la posición numérica de la primera ocurrencia de
<parameter>needle</parameter> en el string <parameter>haystack</parameter>.
</para>
<para>
A diferencia de la función <function>strpos</function>,
<function>stripos</function> no distingue entre mayúsculas y minúsculas.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>haystack</parameter></term>
<listitem>
<para>
El string en el que se realiza la búsqueda.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>needle</parameter></term>
<listitem>
<para>
El string a buscar.
</para>
&strings.parameter.needle.non-string;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
Si se especifica, la búsqueda comenzará a partir de este número
de caracteres, contados desde el inicio del string. Si la posición
es negativa, la búsqueda comenzará utilizando este número de caracteres
pero comenzando desde el final del string.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Devuelve la posición de la primera ocurrencia en el string
en relación con el inicio del string <parameter>haystack</parameter>
(independientemente del offset). Asimismo, se debe tener en cuenta que la posición
en el string comienza en 0, y no en 1.
</para>
<para>
Devuelve &false; si la ocurrencia no ha sido encontrada.
</para>
&return.falseproblem;
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<itemizedlist>
<listitem>
<simpara>
Si <parameter>offset</parameter> es mayor que la longitud de
<parameter>haystack</parameter>, se lanzará un
<classname>ValueError</classname>.
</simpara>
</listitem>
</itemizedlist>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&strings.changelog.ascii-case-folding;
&strings.changelog.needle-empty;
<row>
<entry>8.0.0</entry>
<entry>
Pasar un &integer; como <parameter>needle</parameter> ya no está soportado.
</entry>
</row>
<row>
<entry>7.3.0</entry>
<entry>
Pasar un &integer; como <parameter>before_needle</parameter> ha sido
declarado obsoleto.
</entry>
</row>
<row>
<entry>7.1.0</entry>
<entry>
Se ha añadido soporte para números negativos en el parámetro <parameter>offset</parameter>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Ejemplo con <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' no forma parte de 'xyz'
if ($pos1 === false) {
echo "El string '$findme' no ha sido encontrado en el string '$mystring1'", PHP_EOL;
}
// Observe el uso de !==. Un simple != no daría el resultado esperado
// ya que la letra 'a' está en la posición 0 (la primera).
if ($pos2 !== false) {
echo "El string '$findme' ha sido encontrado en el string '$mystring2'", PHP_EOL;
echo " en la posición $pos2";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
¬e.bin-safe;
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mb_stripos</function></member>
<member><function>str_contains</function></member>
<member><function>str_ends_with</function></member>
<member><function>str_starts_with</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
-->