Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit35532e3

Browse files
committed
Doc: improve description of trim() and related functions.
Per bug #14441 from Mark Pether, the documentation could be misread,mainly because some of the examples failed to show what happens witha multicharacter "characters to trim" string. Also, while the textdescription in most of these entries was fairly clear that the"characters" argument is a set of characters not a substring to match,some of them used variant wording that was a bit less clear.trim() itself suffered from both deficiencies and was thus prettymisinterpretable.Also fix failure to explain which of LEADING/TRAILING/BOTH is thedefault.Discussion:https://postgr.es/m/20161130011710.6539.53657@wrigleys.postgresql.org
1 parenteacdd5d commit35532e3

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,11 +1306,12 @@
13061306
</entry>
13071307
<entry><type>text</type></entry>
13081308
<entry>
1309-
Remove the longest string containing onlythe
1309+
Remove the longest string containing onlycharacters from
13101310
<parameter>characters</parameter> (a space by default) from the
1311-
start/end/both ends of the <parameter>string</parameter>
1311+
start, end, or both ends (<literal>both</> is the default)
1312+
of <parameter>string</parameter>
13121313
</entry>
1313-
<entry><literal>trim(both 'x' from 'xTomxx')</literal></entry>
1314+
<entry><literal>trim(both 'xyz' from 'yxTomxx')</literal></entry>
13141315
<entry><literal>Tom</literal></entry>
13151316
</row>
13161317

@@ -1382,7 +1383,7 @@
13821383
in <parameter>characters</parameter> (a space by default)
13831384
from the start and end of <parameter>string</parameter>
13841385
</entry>
1385-
<entry><literal>btrim('xyxtrimyyx', 'xy')</literal></entry>
1386+
<entry><literal>btrim('xyxtrimyyx', 'xyz')</literal></entry>
13861387
<entry><literal>trim</literal></entry>
13871388
</row>
13881389

@@ -1651,8 +1652,8 @@
16511652
<parameter>characters</parameter> (a space by default) from the start of
16521653
<parameter>string</parameter>
16531654
</entry>
1654-
<entry><literal>ltrim('zzzytrim', 'xyz')</literal></entry>
1655-
<entry><literal>trim</literal></entry>
1655+
<entry><literal>ltrim('zzzytest', 'xyz')</literal></entry>
1656+
<entry><literal>test</literal></entry>
16561657
</row>
16571658

16581659
<row>
@@ -1934,8 +1935,8 @@
19341935
<parameter>characters</parameter> (a space by default) from the end of
19351936
<parameter>string</parameter>
19361937
</entry>
1937-
<entry><literal>rtrim('trimxxxx', 'x')</literal></entry>
1938-
<entry><literal>trim</literal></entry>
1938+
<entry><literal>rtrim('testxxzx', 'xyz')</literal></entry>
1939+
<entry><literal>test</literal></entry>
19391940
</row>
19401941

19411942
<row>
@@ -3199,11 +3200,11 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
31993200
</entry>
32003201
<entry><type>bytea</type></entry>
32013202
<entry>
3202-
Remove the longest string containing onlythebytes in
3203+
Remove the longest string containing only bytes appearing in
32033204
<parameter>bytes</parameter> from the start
32043205
and end of <parameter>string</parameter>
32053206
</entry>
3206-
<entry><literal>trim(E'\\000'::bytea from E'\\000Tom\\000'::bytea)</literal></entry>
3207+
<entry><literal>trim(E'\\000\\001'::bytea from E'\\000Tom\\001'::bytea)</literal></entry>
32073208
<entry><literal>Tom</literal></entry>
32083209
</row>
32093210
</tbody>
@@ -3242,11 +3243,11 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
32423243
</entry>
32433244
<entry><type>bytea</type></entry>
32443245
<entry>
3245-
Remove the longest stringconsisting onlyofbytes
3246-
in<parameter>bytes</parameter> from the start and end of
3246+
Remove the longest stringcontaining only bytes appearing in
3247+
<parameter>bytes</parameter> from the start and end of
32473248
<parameter>string</parameter>
32483249
</entry>
3249-
<entry><literal>btrim(E'\\000trim\\000'::bytea, E'\\000'::bytea)</literal></entry>
3250+
<entry><literal>btrim(E'\\000trim\\001'::bytea, E'\\000\\001'::bytea)</literal></entry>
32503251
<entry><literal>trim</literal></entry>
32513252
</row>
32523253

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp