Skip to content

Commit 27ae0a4

Browse files
saundefinedGirgiasyoukidearitai
authored
[PHP 8.4] Add mb_* functions (#3922)
Co-authored-by: Gina Peter Banyard <[email protected]> Co-authored-by: tekimen <[email protected]>
1 parent 0185cc3 commit 27ae0a4

File tree

10 files changed

+565
-219
lines changed

10 files changed

+565
-219
lines changed

language-snippets.ent

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3774,6 +3774,50 @@ local: {
37743774
'>
37753775

37763776
<!-- strings snippets -->
3777+
<!ENTITY strings.stripped.characters '
3778+
<itemizedlist xmlns="http://docbook.org/ns/docbook">
3779+
<listitem>
3780+
<simpara>
3781+
<literal>" "</literal> (<acronym>ASCII</acronym> 32 (0x20)), an ordinary space.
3782+
</simpara>
3783+
</listitem>
3784+
<listitem>
3785+
<simpara>
3786+
<literal>"\t"</literal> (<acronym>ASCII</acronym> 9 (0x09)), a tab.
3787+
</simpara>
3788+
</listitem>
3789+
<listitem>
3790+
<simpara>
3791+
<literal>"\n"</literal> (<acronym>ASCII</acronym> 10 (0x0A)), a new line (line feed).
3792+
</simpara>
3793+
</listitem>
3794+
<listitem>
3795+
<simpara>
3796+
<literal>"\r"</literal> (<acronym>ASCII</acronym> 13 (0x0D)), a carriage return.
3797+
</simpara>
3798+
</listitem>
3799+
<listitem>
3800+
<simpara>
3801+
<literal>"\0"</literal> (<acronym>ASCII</acronym> 0 (0x00)), the NUL-byte.
3802+
</simpara>
3803+
</listitem>
3804+
<listitem>
3805+
<simpara>
3806+
<literal>"\v"</literal> (<acronym>ASCII</acronym> 11 (0x0B)), a vertical tab.
3807+
</simpara>
3808+
</listitem>
3809+
</itemizedlist>
3810+
'>
3811+
3812+
<!ENTITY strings.parameter.characters.optional '
3813+
<simpara xmlns="http://docbook.org/ns/docbook">
3814+
Optionally, the stripped characters can also be specified using
3815+
the <parameter>characters</parameter> parameter.
3816+
Simply list all characters that need to be stripped.
3817+
With <literal>..</literal> it is possible to specify an incrementing range of characters.
3818+
</simpara>
3819+
'>
3820+
37773821
<!ENTITY strings.parameter.encoding '
37783822
<para xmlns="http://docbook.org/ns/docbook">
37793823
An optional argument defining the encoding used when converting characters.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<refentry xml:id="function.mb-lcfirst" xmlns="http://docbook.org/ns/docbook">
3+
<refnamediv>
4+
<refname>mb_lcfirst</refname>
5+
<refpurpose>Make a string's first character lowercase</refpurpose>
6+
</refnamediv>
7+
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<methodsynopsis>
11+
<type>string</type><methodname>mb_lcfirst</methodname>
12+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
13+
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
14+
</methodsynopsis>
15+
<simpara>
16+
Performs a multi-byte safe <function>lcfirst</function> operation,
17+
and returns a string with the first character of
18+
<parameter>string</parameter> lowercased if that character is
19+
an ASCII character in the range <literal>"A"</literal> (0x41) to
20+
<literal>"Z"</literal> (0x5a).
21+
</simpara>
22+
</refsect1>
23+
24+
<refsect1 role="parameters">
25+
&reftitle.parameters;
26+
<variablelist>
27+
<varlistentry>
28+
<term><parameter>string</parameter></term>
29+
<listitem>
30+
<simpara>
31+
The input string.
32+
</simpara>
33+
</listitem>
34+
</varlistentry>
35+
<varlistentry>
36+
<term><parameter>encoding</parameter></term>
37+
<listitem>
38+
<simpara>
39+
The string encoding.
40+
</simpara>
41+
</listitem>
42+
</varlistentry>
43+
</variablelist>
44+
</refsect1>
45+
46+
<refsect1 role="returnvalues">
47+
&reftitle.returnvalues;
48+
<simpara>
49+
Returns the resulting string.
50+
</simpara>
51+
</refsect1>
52+
53+
<refsect1 role="seealso">
54+
&reftitle.seealso;
55+
<simplelist>
56+
<member><function>mb_ucfirst</function></member>
57+
<member><function>lcfirst</function></member>
58+
</simplelist>
59+
</refsect1>
60+
61+
</refentry>
62+
<!-- Keep this comment at the end of the file
63+
Local variables:
64+
mode: sgml
65+
sgml-omittag:t
66+
sgml-shorttag:t
67+
sgml-minimize-attributes:nil
68+
sgml-always-quote-attributes:t
69+
sgml-indent-step:1
70+
sgml-indent-data:t
71+
indent-tabs-mode:nil
72+
sgml-parent-document:nil
73+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
74+
sgml-exposed-tags:nil
75+
sgml-local-catalogs:nil
76+
sgml-local-ecat-files:nil
77+
End:
78+
vim600: syn=xml fen fdm=syntax fdl=2 si
79+
vim: et tw=78 syn=sgml
80+
vi: ts=1 sw=1
81+
-->
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<refentry xml:id="function.mb-ltrim" xmlns="http://docbook.org/ns/docbook">
3+
<refnamediv>
4+
<refname>mb_ltrim</refname>
5+
<refpurpose>Strip whitespace (or other characters) from the beginning of a string</refpurpose>
6+
</refnamediv>
7+
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<methodsynopsis>
11+
<type>string</type><methodname>mb_ltrim</methodname>
12+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
13+
<methodparam choice="opt"><type>string</type><parameter>characters</parameter><initializer>&null;</initializer></methodparam>
14+
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
15+
</methodsynopsis>
16+
<simpara>
17+
Performs a multi-byte safe <function>ltrim</function> operation.
18+
Strip whitespace (or other characters) from the beginning of a string.
19+
</simpara>
20+
<simpara>
21+
Without the second parameter,
22+
<function>mb_ltrim</function> will strip these characters:
23+
</simpara>
24+
&strings.stripped.characters;
25+
</refsect1>
26+
27+
<refsect1 role="parameters">
28+
&reftitle.parameters;
29+
<variablelist>
30+
<varlistentry>
31+
<term><parameter>string</parameter></term>
32+
<listitem>
33+
<simpara>
34+
The input string.
35+
</simpara>
36+
</listitem>
37+
</varlistentry>
38+
<varlistentry>
39+
<term><parameter>characters</parameter></term>
40+
<listitem>
41+
&strings.parameter.characters.optional;
42+
</listitem>
43+
</varlistentry>
44+
<varlistentry>
45+
<term><parameter>encoding</parameter></term>
46+
<listitem>
47+
<simpara>
48+
The string encoding.
49+
</simpara>
50+
</listitem>
51+
</varlistentry>
52+
</variablelist>
53+
</refsect1>
54+
55+
<refsect1 role="returnvalues">
56+
&reftitle.returnvalues;
57+
<simpara>
58+
This function returns a string with whitespace stripped from the
59+
beginning of <parameter>string</parameter>.
60+
</simpara>
61+
</refsect1>
62+
63+
<refsect1 role="seealso">
64+
&reftitle.seealso;
65+
<simplelist>
66+
<member><function>mb_trim</function></member>
67+
<member><function>mb_rtrim</function></member>
68+
<member><function>ltrim</function></member>
69+
</simplelist>
70+
</refsect1>
71+
72+
</refentry>
73+
<!-- Keep this comment at the end of the file
74+
Local variables:
75+
mode: sgml
76+
sgml-omittag:t
77+
sgml-shorttag:t
78+
sgml-minimize-attributes:nil
79+
sgml-always-quote-attributes:t
80+
sgml-indent-step:1
81+
sgml-indent-data:t
82+
indent-tabs-mode:nil
83+
sgml-parent-document:nil
84+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
85+
sgml-exposed-tags:nil
86+
sgml-local-catalogs:nil
87+
sgml-local-ecat-files:nil
88+
End:
89+
vim600: syn=xml fen fdm=syntax fdl=2 si
90+
vim: et tw=78 syn=sgml
91+
vi: ts=1 sw=1
92+
-->
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<refentry xml:id="function.mb-rtrim" xmlns="http://docbook.org/ns/docbook">
3+
<refnamediv>
4+
<refname>mb_rtrim</refname>
5+
<refpurpose>Strip whitespace (or other characters) from the end of a string</refpurpose>
6+
</refnamediv>
7+
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<methodsynopsis>
11+
<type>string</type><methodname>mb_rtrim</methodname>
12+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
13+
<methodparam choice="opt"><type>string</type><parameter>characters</parameter><initializer>&null;</initializer></methodparam>
14+
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
15+
</methodsynopsis>
16+
<simpara>
17+
Performs a multi-byte safe <function>rtrim</function> operation,
18+
and returns a string with whitespace (or other characters) stripped from the
19+
end of <parameter>string</parameter>.
20+
</simpara>
21+
<simpara>
22+
Without the second parameter,
23+
<function>rtrim</function> will strip these characters:
24+
</simpara>
25+
&strings.stripped.characters;
26+
</refsect1>
27+
28+
<refsect1 role="parameters">
29+
&reftitle.parameters;
30+
<variablelist>
31+
<varlistentry>
32+
<term><parameter>string</parameter></term>
33+
<listitem>
34+
<simpara>
35+
The input string.
36+
</simpara>
37+
</listitem>
38+
</varlistentry>
39+
<varlistentry>
40+
<term><parameter>characters</parameter></term>
41+
<listitem>
42+
&strings.parameter.characters.optional;
43+
</listitem>
44+
</varlistentry>
45+
<varlistentry>
46+
<term><parameter>encoding</parameter></term>
47+
<listitem>
48+
<simpara>
49+
The string encoding.
50+
</simpara>
51+
</listitem>
52+
</varlistentry>
53+
</variablelist>
54+
</refsect1>
55+
56+
<refsect1 role="returnvalues">
57+
&reftitle.returnvalues;
58+
<simpara>
59+
Returns the modified string.
60+
</simpara>
61+
</refsect1>
62+
63+
<refsect1 role="seealso">
64+
&reftitle.seealso;
65+
<simplelist>
66+
<member><function>mb_trim</function></member>
67+
<member><function>mb_ltrim</function></member>
68+
<member><function>rtrim</function></member>
69+
</simplelist>
70+
</refsect1>
71+
72+
</refentry>
73+
<!-- Keep this comment at the end of the file
74+
Local variables:
75+
mode: sgml
76+
sgml-omittag:t
77+
sgml-shorttag:t
78+
sgml-minimize-attributes:nil
79+
sgml-always-quote-attributes:t
80+
sgml-indent-step:1
81+
sgml-indent-data:t
82+
indent-tabs-mode:nil
83+
sgml-parent-document:nil
84+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
85+
sgml-exposed-tags:nil
86+
sgml-local-catalogs:nil
87+
sgml-local-ecat-files:nil
88+
End:
89+
vim600: syn=xml fen fdm=syntax fdl=2 si
90+
vim: et tw=78 syn=sgml
91+
vi: ts=1 sw=1
92+
-->

0 commit comments

Comments
 (0)