reference/strings/functions/ucwords.xml
54ff7bf8e0f8fa90988cccf6b583517366605f6d
...
...
@@ -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.ucwords">
3
+
<refentry xml:id="function.ucwords" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>ucwords</refname>
6
6
<refpurpose>Uppercase the first character of each word in a string</refpurpose>
...
...
@@ -10,19 +10,24 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>string</type><methodname>ucwords</methodname>
13
-
<methodparam><type>string</type><parameter>str</parameter></methodparam>
14
-
<methodparam choice="opt">
15
-
<type>string</type><parameter>delimiters</parameter><initializer>" \t\r\n\f\v"</initializer>
16
-
</methodparam>
13
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
14
+
<methodparam choice="opt"><type>string</type><parameter>separators</parameter><initializer>" \t\r\n\f\v"</initializer></methodparam>
17
15
</methodsynopsis>
18
16
<para>
19
17
Returns a string with the first character of each word in
20
-
<parameter>str</parameter> capitalized, if that character is alphabetic.
18
+
<parameter>string</parameter> capitalized, if that character is an ASCII
19
+
character between <literal>"a"</literal> (0x61) and <literal>"z"</literal>
20
+
(0x7a).
21
21
</para>
22
22
<para>
23
-
The definition of a word is any string of characters that is immediately
24
-
after any character listed in the <parameter>delimiters</parameter> parameter
25
-
(By default these are: space, form-feed, newline, carriage return, horizontal tab, and vertical tab).
23
+
For this function, a word is a string of characters that are not listed in
24
+
the <parameter>separators</parameter> parameter. By default, these are:
25
+
space, horizontal tab, carriage return, newline, form-feed and vertical tab.
26
+
</para>
27
+
<para>
28
+
To do a similar conversion on multibyte strings, use
29
+
<function>mb_convert_case</function> with the <constant>MB_CASE_TITLE</constant>
30
+
mode.
26
31
</para>
27
32
</refsect1>
28
33

...
...
@@ -31,7 +36,7 @@
31
36
<para>
32
37
<variablelist>
33
38
<varlistentry>
34
-
<term><parameter>str</parameter></term>
39
+
<term><parameter>string</parameter></term>
35
40
<listitem>
36
41
<para>
37
42
The input string.
...
...
@@ -39,10 +44,10 @@
39
44
</listitem>
40
45
</varlistentry>
41
46
<varlistentry>
42
-
<term><parameter>delimiters</parameter></term>
47
+
<term><parameter>separators</parameter></term>
43
48
<listitem>
44
49
<para>
45
-
The optional <parameter>delimiters</parameter> contains the word separator characters.
50
+
The optional <parameter>separators</parameter> contains the word separator characters.
46
51
</para>
47
52
</listitem>
48
53
</varlistentry>
...
...
@@ -59,26 +64,19 @@
59
64

60
65
<refsect1 role="changelog">
61
66
&reftitle.changelog;
62
-
<para>
63
-
<informaltable>
64
-
<tgroup cols="2">
65
-
<thead>
66
-
<row>
67
-
<entry>&Version;</entry>
68
-
<entry>&Description;</entry>
69
-
</row>
70
-
</thead>
71
-
<tbody>
72
-
<row>
73
-
<entry>5.4.32, 5.5.16</entry>
74
-
<entry>
75
-
Added the <parameter>delimiters</parameter> parameter.
76
-
</entry>
77
-
</row>
78
-
</tbody>
79
-
</tgroup>
80
-
</informaltable>
81
-
</para>
67
+
<informaltable>
68
+
<tgroup cols="2">
69
+
<thead>
70
+
<row>
71
+
<entry>&Version;</entry>
72
+
<entry>&Description;</entry>
73
+
</row>
74
+
</thead>
75
+
<tbody>
76
+
&strings.changelog.ascii-case-conversion;
77
+
</tbody>
78
+
</tgroup>
79
+
</informaltable>
82
80
</refsect1>
83
81

84
82
<refsect1 role="examples">
...
...
@@ -116,6 +114,22 @@ $baz = ucwords($foo, "|"); // Hello|World!
116
114
</programlisting>
117
115
</example>
118
116
</para>
117
+

118
+
<para>
119
+
<example>
120
+
<title><function>ucwords</function> example with additional delimiters</title>
121
+
<programlisting role="php">
122
+
<![CDATA[
123
+
<?php
124
+
$foo = "mike o'hara";
125
+
$bar = ucwords($foo); // Mike O'hara
126
+

127
+
$baz = ucwords($foo, " \t\r\n\f\v'"); // Mike O'Hara
128
+
?>
129
+
]]>
130
+
</programlisting>
131
+
</example>
132
+
</para>
119
133
</refsect1>
120
134

121
135
<refsect1 role="notes">
...
...
@@ -136,7 +150,6 @@ $baz = ucwords($foo, "|"); // Hello|World!
136
150
</refsect1>
137
151

138
152
</refentry>
139
-

140
153
<!-- Keep this comment at the end of the file
141
154
Local variables:
142
155
mode: sgml
143
156