new string functions doc - Mailing list pgsql-patches
From | Joe Conway |
---|---|
Subject | new string functions doc |
Date | |
Msg-id | 3D716160.101@joeconway.com Whole thread Raw |
Responses |
Re: new string functions doc
|
List | pgsql-patches |
Here's a doc patch for the new string functions recently committed -- replace, split, and to_hex. The patch also moves encode and decode into alphabetical order (since everything else in the table was). Please apply if there are no objections. Thanks, Joe Index: doc/src/sgml/func.sgml =================================================================== RCS file: /opt/src/cvs/pgsql-server/doc/src/sgml/func.sgml,v retrieving revision 1.118 diff -c -r1.118 func.sgml *** doc/src/sgml/func.sgml 29 Aug 2002 05:17:55 -0000 1.118 --- doc/src/sgml/func.sgml 31 Aug 2002 23:55:49 -0000 *************** *** 1728,1733 **** --- 1728,1761 ---- </row> <row> + <entry> + <function>decode</function>(<parameter>string</parameter> <type>text</type>, + <parameter>type</parameter> <type>text</type>) + </entry> + <entry><type>bytea</type></entry> + <entry> + Decodes binary data from <parameter>string</parameter> previously + encoded with encode(). Parameter type is same as in encode(). + </entry> + <entry><literal>decode('MTIzAAE=', 'base64')</literal></entry> + <entry><literal>123\000\001</literal></entry> + </row> + + <row> + <entry> + <function>encode</function>(<parameter>data</parameter> <type>bytea</type>, + <parameter>type</parameter> <type>text</type>) + </entry> + <entry><type>text</type></entry> + <entry> + Encodes binary data to <acronym>ASCII</acronym>-only representation. Supported + types are: 'base64', 'hex', 'escape'. + </entry> + <entry><literal>encode('123\\000\\001', 'base64')</literal></entry> + <entry><literal>MTIzAAE=</literal></entry> + </row> + + <row> <entry><function>initcap</function>(<type>text</type>)</entry> <entry><type>text</type></entry> <entry>Converts first letter of each word (whitespace separated) to upper case.</entry> *************** *** 1829,1834 **** --- 1857,1874 ---- </row> <row> + <entry><function>replace</function>(<parameter>string</parameter> <type>text</type>, + <parameter>from</parameter> <type>text</type>, + <parameter>to</parameter> <type>text</type>)</entry> + <entry><type>text</type></entry> + <entry>Replace all occurrences in <parameter>string</parameter> of substring + <parameter>from</parameter> with substring <parameter>to</parameter> + </entry> + <entry><literal>replace('abcdefabcdef', 'cd', 'XX')</literal></entry> + <entry><literal>abXXefabXXef</literal></entry> + </row> + + <row> <entry> <function>rpad</function>(<parameter>string</parameter> <type>text</type>, <parameter>length</parameter> <type>integer</type> *************** *** 1859,1864 **** --- 1899,1916 ---- </row> <row> + <entry><function>split</function>(<parameter>string</parameter> <type>text</type>, + <parameter>delimiter</parameter> <type>text</type>, + <parameter>column</parameter> <type>integer</type>)</entry> + <entry><type>text</type></entry> + <entry>Split <parameter>string</parameter> on <parameter>delimiter</parameter> + returning the resulting (one based) <parameter>column</parameter> number. + </entry> + <entry><literal>split('abc~@~def~@~ghi','~@~',2)</literal></entry> + <entry><literal>def</literal></entry> + </row> + + <row> <entry><function>strpos</function>(<parameter>string</parameter>, <parameter>substring</parameter>)</entry> <entry><type>text</type></entry> <entry> *************** *** 1892,1897 **** --- 1944,1960 ---- </row> <row> + <entry><function>to_hex</function>(<parameter>number</parameter> <type>integer</type> + or <type>bigint</type>)</entry> + <entry><type>text</type></entry> + <entry>Convert <parameter>number</parameter> to its equivalent hexadecimal + representation. + </entry> + <entry><literal>to_hex(9223372036854775807::bigint)</literal></entry> + <entry><literal>7fffffffffffffff</literal></entry> + </row> + + <row> <entry> <function>translate</function>(<parameter>string</parameter> <type>text</type>, *************** *** 1909,1942 **** <entry><literal>a23x5</literal></entry> </row> - <row> - <entry> - <function>encode</function>(<parameter>data</parameter> <type>bytea</type>, - <parameter>type</parameter> <type>text</type>) - </entry> - <entry><type>text</type></entry> - <entry> - Encodes binary data to <acronym>ASCII</acronym>-only representation. Supported - types are: 'base64', 'hex', 'escape'. - </entry> - <entry><literal>encode('123\\000\\001', 'base64')</literal></entry> - <entry><literal>MTIzAAE=</literal></entry> - </row> - - <row> - <entry> - <function>decode</function>(<parameter>string</parameter> <type>text</type>, - <parameter>type</parameter> <type>text</type>) - </entry> - <entry><type>bytea</type></entry> - <entry> - Decodes binary data from <parameter>string</parameter> previously - encoded with encode(). Parameter type is same as in encode(). - </entry> - <entry><literal>decode('MTIzAAE=', 'base64')</literal></entry> - <entry><literal>123\000\001</literal></entry> - </row> - </tbody> </tgroup> </table> --- 1972,1977 ----
pgsql-patches by date: