reference/strings/functions/strspn.xml
422bb032237525aaf50e6a43f33362a2c610a1d7
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.strspn">
3
+
<refentry xml:id="function.strspn" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>strspn</refname>
6
6
<refpurpose>
...
...
@@ -13,21 +13,21 @@
13
13
&reftitle.description;
14
14
<methodsynopsis>
15
15
<type>int</type><methodname>strspn</methodname>
16
-
<methodparam><type>string</type><parameter>subject</parameter></methodparam>
17
-
<methodparam><type>string</type><parameter>mask</parameter></methodparam>
18
-
<methodparam choice="opt"><type>int</type><parameter>start</parameter></methodparam>
19
-
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
16
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
17
+
<methodparam><type>string</type><parameter>characters</parameter></methodparam>
18
+
<methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>0</initializer></methodparam>
19
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>length</parameter><initializer>&null;</initializer></methodparam>
20
20
</methodsynopsis>
21
21
<para>
22
-
Finds the length of the initial segment of <parameter>subject</parameter>
23
-
that contains <emphasis>only</emphasis> characters from <parameter>mask</parameter>.
22
+
Finds the length of the initial segment of <parameter>string</parameter>
23
+
that contains <emphasis>only</emphasis> characters from <parameter>characters</parameter>.
24
24
</para>
25
25
<para>
26
-
If <parameter>start</parameter> and <parameter>length</parameter>
27
-
are omitted, then all of <parameter>subject</parameter> will be
26
+
If <parameter>offset</parameter> and <parameter>length</parameter>
27
+
are omitted, then all of <parameter>string</parameter> will be
28
28
examined. If they are included, then the effect will be the same as
29
-
calling <literal>strspn(substr($subject, $start, $length),
30
-
$mask)</literal> (see <xref linkend="function.substr" />
29
+
calling <literal>strspn(substr($string, $offset, $length),
30
+
$characters)</literal> (see <xref linkend="function.substr"/>
31
31
for more information).
32
32
</para>
33
33
<para>
...
...
@@ -43,7 +43,7 @@ $var = strspn("42 is the answer to the 128th question.", "1234567890");
43
43
</informalexample>
44
44
will assign <literal>2</literal> to <varname>$var</varname>,
45
45
because the string "42" is the initial segment
46
-
of <parameter>subject</parameter> that consists only of characters
46
+
of <parameter>string</parameter> that consists only of characters
47
47
contained within "1234567890".
48
48
</para>
49
49
</refsect1>
...
...
@@ -53,7 +53,7 @@ $var = strspn("42 is the answer to the 128th question.", "1234567890");
53
53
<para>
54
54
<variablelist>
55
55
<varlistentry>
56
-
<term><parameter>subject</parameter></term>
56
+
<term><parameter>string</parameter></term>
57
57
<listitem>
58
58
<para>
59
59
The string to examine.
...
...
@@ -61,7 +61,7 @@ $var = strspn("42 is the answer to the 128th question.", "1234567890");
61
61
</listitem>
62
62
</varlistentry>
63
63
<varlistentry>
64
-
<term><parameter>mask</parameter></term>
64
+
<term><parameter>characters</parameter></term>
65
65
<listitem>
66
66
<para>
67
67
The list of allowable characters.
...
...
@@ -69,28 +69,28 @@ $var = strspn("42 is the answer to the 128th question.", "1234567890");
69
69
</listitem>
70
70
</varlistentry>
71
71
<varlistentry>
72
-
<term><parameter>start</parameter></term>
72
+
<term><parameter>offset</parameter></term>
73
73
<listitem>
74
74
<para>
75
-
The position in <parameter>subject</parameter> to
75
+
The position in <parameter>string</parameter> to
76
76
start searching.
77
77
</para>
78
78
<para>
79
-
If <parameter>start</parameter> is given and is non-negative,
79
+
If <parameter>offset</parameter> is given and is non-negative,
80
80
then <function>strspn</function> will begin
81
-
examining <parameter>subject</parameter> at
82
-
the <parameter>start</parameter>'th position. For instance, in
81
+
examining <parameter>string</parameter> at
82
+
the <parameter>offset</parameter>'th position. For instance, in
83
83
the string '<literal>abcdef</literal>', the character at
84
84
position <literal>0</literal> is '<literal>a</literal>', the
85
85
character at position <literal>2</literal> is
86
86
'<literal>c</literal>', and so forth.
87
87
</para>
88
88
<para>
89
-
If <parameter>start</parameter> is given and is negative,
89
+
If <parameter>offset</parameter> is given and is negative,
90
90
then <function>strspn</function> will begin
91
-
examining <parameter>subject</parameter> at
92
-
the <parameter>start</parameter>'th position from the end
93
-
of <parameter>subject</parameter>.
91
+
examining <parameter>string</parameter> at
92
+
the <parameter>offset</parameter>'th position from the end
93
+
of <parameter>string</parameter>.
94
94
</para>
95
95
</listitem>
96
96
</varlistentry>
...
...
@@ -98,20 +98,20 @@ $var = strspn("42 is the answer to the 128th question.", "1234567890");
98
98
<term><parameter>length</parameter></term>
99
99
<listitem>
100
100
<para>
101
-
The length of the segment from <parameter>subject</parameter>
101
+
The length of the segment from <parameter>string</parameter>
102
102
to examine.
103
103
</para>
104
104
<para>
105
105
If <parameter>length</parameter> is given and is non-negative,
106
-
then <parameter>subject</parameter> will be examined
106
+
then <parameter>string</parameter> will be examined
107
107
for <parameter>length</parameter> characters after the starting
108
108
position.
109
109
</para>
110
110
<para>
111
111
If <parameter>length</parameter> is given and is negative,
112
-
then <parameter>subject</parameter> will be examined from the
112
+
then <parameter>string</parameter> will be examined from the
113
113
starting position up to <parameter>length</parameter>
114
-
characters from the end of <parameter>subject</parameter>.
114
+
characters from the end of <parameter>string</parameter>.
115
115
</para>
116
116
</listitem>
117
117
</varlistentry>
...
...
@@ -122,18 +122,40 @@ $var = strspn("42 is the answer to the 128th question.", "1234567890");
122
122
<refsect1 role="returnvalues">
123
123
&reftitle.returnvalues;
124
124
<para>
125
-
Returns the length of the initial segment of <parameter>subject</parameter>
126
-
which consists entirely of characters in <parameter>mask</parameter>.
125
+
Returns the length of the initial segment of <parameter>string</parameter>
126
+
which consists entirely of characters in <parameter>characters</parameter>.
127
127
</para>
128
128
<note>
129
129
<para>
130
-
When a <parameter>start</parameter> parameter is set, the returned length
130
+
When a <parameter>offset</parameter> parameter is set, the returned length
131
131
is counted starting from this position, not from the beginning of
132
-
<parameter>subject</parameter>.
132
+
<parameter>string</parameter>.
133
133
</para>
134
134
</note>
135
135
</refsect1>
136
136

137
+
<refsect1 role="changelog">
138
+
&reftitle.changelog;
139
+
<informaltable>
140
+
<tgroup cols="2">
141
+
<thead>
142
+
<row>
143
+
<entry>&Version;</entry>
144
+
<entry>&Description;</entry>
145
+
</row>
146
+
</thead>
147
+
<tbody>
148
+
<row>
149
+
<entry>8.0.0</entry>
150
+
<entry>
151
+
<parameter>length</parameter> is nullable now.
152
+
</entry>
153
+
</row>
154
+
</tbody>
155
+
</tgroup>
156
+
</informaltable>
157
+
</refsect1>
158
+

137
159
<refsect1 role="examples">
138
160
&reftitle.examples;
139
161
<para>
...
...
@@ -180,7 +202,6 @@ int(1)
180
202
</refsect1>
181
203

182
204
</refentry>
183
-

184
205
<!-- Keep this comment at the end of the file
185
206
Local variables:
186
207
mode: sgml
187
208