reference/strings/functions/wordwrap.xml
e095023e408c8cb6378ae16bb6870343a3946919
...
...
@@ -1,6 +1,6 @@
1
-
<?xml version="1.0" encoding="iso-8859-1"?>
1
+
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.wordwrap">
3
+
<refentry xml:id="function.wordwrap" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>wordwrap</refname>
6
6
<refpurpose>Wraps a string to a given number of characters</refpurpose>
...
...
@@ -10,10 +10,10 @@
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
12
<type>string</type><methodname>wordwrap</methodname>
13
-
<methodparam><type>string</type><parameter>str</parameter></methodparam>
13
+
<methodparam><type>string</type><parameter>string</parameter></methodparam>
14
14
<methodparam choice="opt"><type>int</type><parameter>width</parameter><initializer>75</initializer></methodparam>
15
15
<methodparam choice="opt"><type>string</type><parameter>break</parameter><initializer>"\n"</initializer></methodparam>
16
-
<methodparam choice="opt"><type>bool</type><parameter>cut</parameter><initializer>false</initializer></methodparam>
16
+
<methodparam choice="opt"><type>bool</type><parameter>cut_long_words</parameter><initializer>&false;</initializer></methodparam>
17
17
</methodsynopsis>
18
18
<para>
19
19
Wraps a string to a given number of characters using a string break
...
...
@@ -26,7 +26,7 @@
26
26
<para>
27
27
<variablelist>
28
28
<varlistentry>
29
-
<term><parameter>str</parameter></term>
29
+
<term><parameter>string</parameter></term>
30
30
<listitem>
31
31
<para>
32
32
The input string.
...
...
@@ -37,7 +37,7 @@
37
37
<term><parameter>width</parameter></term>
38
38
<listitem>
39
39
<para>
40
-
The column width. Defaults to 75.
40
+
The number of characters at which the string will be wrapped.
41
41
</para>
42
42
</listitem>
43
43
</varlistentry>
...
...
@@ -46,19 +46,19 @@
46
46
<listitem>
47
47
<para>
48
48
The line is broken using the optional
49
-
<parameter>break</parameter> parameter. Defaults to
50
-
'<literal>\n</literal>'.
49
+
<parameter>break</parameter> parameter.
51
50
</para>
52
51
</listitem>
53
52
</varlistentry>
54
53
<varlistentry>
55
-
<term><parameter>cut</parameter></term>
54
+
<term><parameter>cut_long_words</parameter></term>
56
55
<listitem>
57
56
<para>
58
-
If the <parameter>cut</parameter> is set to &true;, the string is
59
-
always wrapped at or before the specified width. So if you have
57
+
If the <parameter>cut_long_words</parameter> is set to &true;, the string is
58
+
always wrapped at or before the specified <parameter>width</parameter>. So if you have
60
59
a word that is larger than the given width, it is broken apart.
61
-
(See second example).
60
+
(See second example). When &false; the function does not split the word
61
+
even if the <parameter>width</parameter> is smaller than the word width.
62
62
</para>
63
63
</listitem>
64
64
</varlistentry>
...
...
@@ -69,31 +69,7 @@
69
69
<refsect1 role="returnvalues">
70
70
&reftitle.returnvalues;
71
71
<para>
72
-
Returns the given string wrapped at the specified column.
73
-
</para>
74
-
</refsect1>
75
-

76
-
<refsect1 role="changelog">
77
-
&reftitle.changelog;
78
-
<para>
79
-
<informaltable>
80
-
<tgroup cols="2">
81
-
<thead>
82
-
<row>
83
-
<entry>&Version;</entry>
84
-
<entry>&Description;</entry>
85
-
</row>
86
-
</thead>
87
-
<tbody>
88
-
<row>
89
-
<entry>4.0.3</entry>
90
-
<entry>
91
-
The optional <parameter>cut</parameter> parameter was added.
92
-
</entry>
93
-
</row>
94
-
</tbody>
95
-
</tgroup>
96
-
</informaltable>
72
+
Returns the given string wrapped at the specified length.
97
73
</para>
98
74
</refsect1>
99
75

...
...
@@ -143,6 +119,29 @@ ooooord.
143
119
]]>
144
120
</screen>
145
121
</example>
122
+
<example>
123
+
<title><function>wordwrap</function> example</title>
124
+
<programlisting role="php">
125
+
<![CDATA[
126
+
<?php
127
+
$text = "A very long woooooooooooooooooord. and something";
128
+
$newtext = wordwrap($text, 8, "\n", false);
129
+

130
+
echo "$newtext\n";
131
+
?>
132
+
]]>
133
+
</programlisting>
134
+
&example.outputs;
135
+
<screen>
136
+
<![CDATA[
137
+
A very
138
+
long
139
+
woooooooooooooooooord.
140
+
and
141
+
something
142
+
]]>
143
+
</screen>
144
+
</example>
146
145
</para>
147
146
</refsect1>
148
147

...
...
@@ -157,7 +156,6 @@ ooooord.
157
156
</refsect1>
158
157

159
158
</refentry>
160
-

161
159
<!-- Keep this comment at the end of the file
162
160
Local variables:
163
161
mode: sgml
164
162