reference/mbstring/functions/mb-strcut.xml
92f1b8b177eb5730382abf9f27bae868f1bb636f
...
...
@@ -10,10 +10,10 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>string</type><methodname>mb_strcut</methodname>
13
-
<methodparam><type>string</type><parameter>str</parameter></methodparam>
13
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
14
14
<methodparam><type>int</type><parameter>start</parameter></methodparam>
15
-
<methodparam choice="opt"><type>int</type><parameter>length</parameter><initializer>NULL</initializer></methodparam>
16
-
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter><initializer>mb_internal_encoding()</initializer></methodparam>
15
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>length</parameter><initializer>&null;</initializer></methodparam>
16
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
17
17
</methodsynopsis>
18
18
<para>
19
19
<function>mb_strcut</function> extracts a substring from a string similarly to
...
...
@@ -30,7 +30,7 @@
30
30
<para>
31
31
<variablelist>
32
32
<varlistentry>
33
-
<term><parameter>str</parameter></term>
33
+
<term><parameter>string</parameter></term>
34
34
<listitem>
35
35
<para>
36
36
The <type>string</type> being cut.
...
...
@@ -43,7 +43,7 @@
43
43
<para>
44
44
If <parameter>start</parameter> is non-negative, the returned string
45
45
will start at the <parameter>start</parameter>'th <emphasis>byte</emphasis> position in
46
-
<parameter>str</parameter>, counting from zero. For instance,
46
+
<parameter>string</parameter>, counting from zero. For instance,
47
47
in the string '<literal>abcdef</literal>', the byte at
48
48
position <literal>0</literal> is '<literal>a</literal>', the
49
49
byte at position <literal>2</literal> is
...
...
@@ -52,7 +52,10 @@
52
52
<para>
53
53
If <parameter>start</parameter> is negative, the returned string
54
54
will start at the <parameter>start</parameter>'th byte
55
-
from the end of <parameter>str</parameter>.
55
+
counting back from the end of <parameter>string</parameter>. However, if the
56
+
magnitude of a negative <parameter>start</parameter> is greater than the
57
+
length of the string, the returned portion will start from the beginning of
58
+
<parameter>string</parameter>.
56
59
</para>
57
60
</listitem>
58
61
</varlistentry>
...
...
@@ -63,6 +66,14 @@
63
66
Length in <emphasis>bytes</emphasis>. If omitted or <literal>NULL</literal>
64
67
is passed, extract all bytes to the end of the string.
65
68
</para>
69
+
<para>
70
+
If <parameter>length</parameter> is negative, the returned string will
71
+
end at the <parameter>length</parameter>'th byte counting back from the
72
+
end of <parameter>string</parameter>. However, if the magnitude of a negative
73
+
<parameter>length</parameter> is greater than the number of characters
74
+
after the <parameter>start</parameter> position, an empty string will
75
+
be returned.
76
+
</para>
66
77
</listitem>
67
78
</varlistentry>
68
79
<varlistentry>
...
...
@@ -79,7 +90,7 @@
79
90
&reftitle.returnvalues;
80
91
<para>
81
92
<function>mb_strcut</function> returns the portion of
82
-
<parameter>str</parameter> specified by the
93
+
<parameter>string</parameter> specified by the
83
94
<parameter>start</parameter> and
84
95
<parameter>length</parameter> parameters.
85
96
</para>
...
...
@@ -87,28 +98,19 @@
87
98

88
99
<refsect1 role="changelog">
89
100
&reftitle.changelog;
90
-
<para>
91
-
<informaltable>
92
-
<tgroup cols="2">
93
-
<thead>
94
-
<row>
95
-
<entry>&Version;</entry>
96
-
<entry>&Description;</entry>
97
-
</row>
98
-
</thead>
99
-
<tbody>
100
-
<row>
101
-
<entry>5.4.8</entry>
102
-
<entry>
103
-
Passing <literal>NULL</literal> as <parameter>length</parameter>
104
-
extracts all bytes to the end of the string. Prior to this version
105
-
<literal>NULL</literal> was treated the same as <literal>0</literal>.
106
-
</entry>
107
-
</row>
108
-
</tbody>
109
-
</tgroup>
110
-
</informaltable>
111
-
</para>
101
+
<informaltable>
102
+
<tgroup cols="2">
103
+
<thead>
104
+
<row>
105
+
<entry>&Version;</entry>
106
+
<entry>&Description;</entry>
107
+
</row>
108
+
</thead>
109
+
<tbody>
110
+
&mbstring.changelog.encoding-nullable;
111
+
</tbody>
112
+
</tgroup>
113
+
</informaltable>
112
114
</refsect1>
113
115

114
116
<refsect1 role="seealso">
...
...
@@ -122,7 +124,6 @@
122
124
</refsect1>
123
125

124
126
</refentry>
125
-

126
127
<!-- Keep this comment at the end of the file
127
128
Local variables:
128
129
mode: sgml
129
130