File: mb-strcut.xml

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (146 lines) | stat: -rw-r--r-- 5,012 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.mb-strcut" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>mb_strcut</refname>
  <refpurpose>Get part of string</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>string</type><methodname>mb_strcut</methodname>
   <methodparam><type>string</type><parameter>string</parameter></methodparam>
   <methodparam><type>int</type><parameter>start</parameter></methodparam>
   <methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>length</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
  </methodsynopsis>
  <para>
   <function>mb_strcut</function> extracts a substring from a string similarly to
   <function>mb_substr</function>, but operates on bytes instead of characters. If the
   cut position happens to be between two bytes of a multi-byte character, the cut is
   performed starting from the first byte of that character. This is also the difference
   to the <function>substr</function> function, which would simply cut the string between
   the bytes and thus result in a malformed byte sequence.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>string</parameter></term>
     <listitem>
      <para>
       The <type>string</type> being cut.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>start</parameter></term>
     <listitem>
      <para>
       If <parameter>start</parameter> is non-negative, the returned string
       will start at the <parameter>start</parameter>'th <emphasis>byte</emphasis> position in
       <parameter>string</parameter>, counting from zero. For instance,
       in the string '<literal>abcdef</literal>', the byte at
       position <literal>0</literal> is '<literal>a</literal>', the
       byte at position <literal>2</literal> is
       '<literal>c</literal>', and so forth.
      </para>
      <para>
       If <parameter>start</parameter> is negative, the returned string
       will start at the <parameter>start</parameter>'th byte
       counting back from the end of <parameter>string</parameter>. However, if the
       magnitude of a negative <parameter>start</parameter> is greater than the
       length of the string, the returned portion will start from the beginning of
       <parameter>string</parameter>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>length</parameter></term>
     <listitem>
      <para>
       Length in <emphasis>bytes</emphasis>. If omitted or <literal>NULL</literal>
       is passed, extract all bytes to the end of the string.
      </para>
      <para>
       If <parameter>length</parameter> is negative, the returned string will
       end at the <parameter>length</parameter>'th byte counting back from the
       end of <parameter>string</parameter>. However, if the magnitude of a negative
       <parameter>length</parameter> is greater than the number of characters
       after the <parameter>start</parameter> position, an empty string will
       be returned.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>encoding</parameter></term>
     <listitem>
      &mbstring.encoding.parameter;
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   <function>mb_strcut</function> returns the portion of
   <parameter>string</parameter> specified by the
   <parameter>start</parameter> and
   <parameter>length</parameter> parameters.
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <informaltable>
   <tgroup cols="2">
    <thead>
     <row>
      <entry>&Version;</entry>
      <entry>&Description;</entry>
     </row>
    </thead>
    <tbody>
     &mbstring.changelog.encoding-nullable;
    </tbody>
   </tgroup>
  </informaltable>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>mb_substr</function></member>
    <member><function>mb_internal_encoding</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
-->