reference/strings/functions/strcspn.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.strcspn">
3
+
<refentry xml:id="function.strcspn" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>strcspn</refname>
6
6
<refpurpose>Find length of initial segment not matching mask</refpurpose>
...
...
@@ -10,22 +10,22 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>int</type><methodname>strcspn</methodname>
13
-
<methodparam><type>string</type><parameter>subject</parameter></methodparam>
14
-
<methodparam><type>string</type><parameter>mask</parameter></methodparam>
15
-
<methodparam choice="opt"><type>int</type><parameter>start</parameter></methodparam>
16
-
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
13
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
14
+
<methodparam><type>string</type><parameter>characters</parameter></methodparam>
15
+
<methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>0</initializer></methodparam>
16
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>length</parameter><initializer>&null;</initializer></methodparam>
17
17
</methodsynopsis>
18
18
<para>
19
19
Returns the length of the initial segment of
20
-
<parameter>subject</parameter> which does <emphasis>not</emphasis>
21
-
contain any of the characters in <parameter>mask</parameter>.
20
+
<parameter>string</parameter> which does <emphasis>not</emphasis>
21
+
contain any of the characters in <parameter>characters</parameter>.
22
22
</para>
23
23
<para>
24
-
If <parameter>start</parameter> and <parameter>length</parameter>
25
-
are omitted, then all of <parameter>subject</parameter> will be
24
+
If <parameter>offset</parameter> and <parameter>length</parameter>
25
+
are omitted, then all of <parameter>string</parameter> will be
26
26
examined. If they are included, then the effect will be the same as
27
-
calling <literal>strcspn(substr($subject, $start, $length),
28
-
$mask)</literal> (see <xref linkend="function.substr" />
27
+
calling <literal>strcspn(substr($string, $offset, $length),
28
+
$characters)</literal> (see <xref linkend="function.substr"/>
29
29
for more information).
30
30
</para>
31
31
</refsect1>
...
...
@@ -35,7 +35,7 @@
35
35
<para>
36
36
<variablelist>
37
37
<varlistentry>
38
-
<term><parameter>subject</parameter></term>
38
+
<term><parameter>string</parameter></term>
39
39
<listitem>
40
40
<para>
41
41
The string to examine.
...
...
@@ -43,7 +43,7 @@
43
43
</listitem>
44
44
</varlistentry>
45
45
<varlistentry>
46
-
<term><parameter>mask</parameter></term>
46
+
<term><parameter>characters</parameter></term>
47
47
<listitem>
48
48
<para>
49
49
The string containing every disallowed character.
...
...
@@ -51,28 +51,28 @@
51
51
</listitem>
52
52
</varlistentry>
53
53
<varlistentry>
54
-
<term><parameter>start</parameter></term>
54
+
<term><parameter>offset</parameter></term>
55
55
<listitem>
56
56
<para>
57
-
The position in <parameter>subject</parameter> to
57
+
The position in <parameter>string</parameter> to
58
58
start searching.
59
59
</para>
60
60
<para>
61
-
If <parameter>start</parameter> is given and is non-negative,
61
+
If <parameter>offset</parameter> is given and is non-negative,
62
62
then <function>strcspn</function> will begin
63
-
examining <parameter>subject</parameter> at
64
-
the <parameter>start</parameter>'th position. For instance, in
63
+
examining <parameter>string</parameter> at
64
+
the <parameter>offset</parameter>'th position. For instance, in
65
65
the string '<literal>abcdef</literal>', the character at
66
66
position <literal>0</literal> is '<literal>a</literal>', the
67
67
character at position <literal>2</literal> is
68
68
'<literal>c</literal>', and so forth.
69
69
</para>
70
70
<para>
71
-
If <parameter>start</parameter> is given and is negative,
71
+
If <parameter>offset</parameter> is given and is negative,
72
72
then <function>strcspn</function> will begin
73
-
examining <parameter>subject</parameter> at
74
-
the <parameter>start</parameter>'th position from the end
75
-
of <parameter>subject</parameter>.
73
+
examining <parameter>string</parameter> at
74
+
the <parameter>offset</parameter>'th position from the end
75
+
of <parameter>string</parameter>.
76
76
</para>
77
77
</listitem>
78
78
</varlistentry>
...
...
@@ -80,20 +80,20 @@
80
80
<term><parameter>length</parameter></term>
81
81
<listitem>
82
82
<para>
83
-
The length of the segment from <parameter>subject</parameter>
83
+
The length of the segment from <parameter>string</parameter>
84
84
to examine.
85
85
</para>
86
86
<para>
87
87
If <parameter>length</parameter> is given and is non-negative,
88
-
then <parameter>subject</parameter> will be examined
88
+
then <parameter>string</parameter> will be examined
89
89
for <parameter>length</parameter> characters after the starting
90
90
position.
91
91
</para>
92
92
<para>
93
93
If <parameter>length</parameter> is given and is negative,
94
-
then <parameter>subject</parameter> will be examined from the
94
+
then <parameter>string</parameter> will be examined from the
95
95
starting position up to <parameter>length</parameter>
96
-
characters from the end of <parameter>subject</parameter>.
96
+
characters from the end of <parameter>string</parameter>.
97
97
</para>
98
98
</listitem>
99
99
</varlistentry>
...
...
@@ -104,18 +104,40 @@
104
104
<refsect1 role="returnvalues">
105
105
&reftitle.returnvalues;
106
106
<para>
107
-
Returns the length of the initial segment of <parameter>subject</parameter>
108
-
which consists entirely of characters <emphasis>not</emphasis> in <parameter>mask</parameter>.
107
+
Returns the length of the initial segment of <parameter>string</parameter>
108
+
which consists entirely of characters <emphasis>not</emphasis> in <parameter>characters</parameter>.
109
109
</para>
110
110
<note>
111
111
<para>
112
-
When a <parameter>start</parameter> parameter is set, the returned length
112
+
When a <parameter>offset</parameter> parameter is set, the returned length
113
113
is counted starting from this position, not from the beginning of
114
-
<parameter>subject</parameter>.
114
+
<parameter>string</parameter>.
115
115
</para>
116
116
</note>
117
117
</refsect1>
118
118

119
+
<refsect1 role="changelog">
120
+
&reftitle.changelog;
121
+
<informaltable>
122
+
<tgroup cols="2">
123
+
<thead>
124
+
<row>
125
+
<entry>&Version;</entry>
126
+
<entry>&Description;</entry>
127
+
</row>
128
+
</thead>
129
+
<tbody>
130
+
<row>
131
+
<entry>8.0.0</entry>
132
+
<entry>
133
+
<parameter>length</parameter> is nullable now.
134
+
</entry>
135
+
</row>
136
+
</tbody>
137
+
</tgroup>
138
+
</informaltable>
139
+
</refsect1>
140
+

119
141
<refsect1 role="examples">
120
142
&reftitle.examples;
121
143
<example xml:id="strcspn.example">
...
...
@@ -168,7 +190,6 @@ int(4)
168
190
</refsect1>
169
191
170
192
</refentry>
171
-

172
193
<!-- Keep this comment at the end of the file
173
194
Local variables:
174
195
mode: sgml
175
196