Commit e82bcba5 authored by Bruce Momjian's avatar Bruce Momjian

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).

Joe Conway
parent ab5fe2a9
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.119 2002/09/01 23:26:05 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.120 2002/09/02 05:53:23 momjian Exp $
PostgreSQL documentation
-->
......@@ -1727,6 +1727,34 @@ PostgreSQL documentation
<entry><literal>text_in_unicode</literal> represented in ISO 8859-1</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>
<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>
......@@ -1828,6 +1856,18 @@ PostgreSQL documentation
<entry><literal>PgPgPgPg</literal></entry>
</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>,
......@@ -1858,6 +1898,18 @@ PostgreSQL documentation
<entry><literal>trim</literal></entry>
</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>
......@@ -1891,6 +1943,17 @@ PostgreSQL documentation
<entry><literal>Karel</literal></entry>
</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>
......@@ -1909,34 +1972,6 @@ PostgreSQL documentation
<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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment