new string functions doc
new string functions doc
От:
Joe Conway <mail@joeconway.com>
Дата:
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 ----
+
+ decode(string text,
+ type text)
+
+ bytea
+
+ Decodes binary data from string previously
+ encoded with encode(). Parameter type is same as in encode().
+
+ decode('MTIzAAE=', 'base64')
+ 123\000\001
+
+
+
+
+ encode(data bytea,
+ type text)
+
+ text
+
+ Encodes binary data to ASCII-only representation. Supported
+ types are: 'base64', 'hex', 'escape'.
+
+ encode('123\\000\\001', 'base64')
+ MTIzAAE=
+
+
+
initcap(text)
text
Converts first letter of each word (whitespace separated) to upper case.
***************
*** 1829,1834 ****
--- 1857,1874 ----
+ replace(string text,
+ from text,
+ to text)
+ text
+ Replace all occurrences in string of substring
+ from with substring to
+
+ replace('abcdefabcdef', 'cd', 'XX')
+ abXXefabXXef
+
+
+
rpad(string text,
length integer
***************
*** 1859,1864 ****
--- 1899,1916 ----
+ split(string text,
+ delimiter text,
+ column integer)
+ text
+ Split string on delimiter
+ returning the resulting (one based) column number.
+
+ split('abc~@~def~@~ghi','~@~',2)
+ def
+
+
+
strpos(string, substring)
text
***************
*** 1892,1897 ****
--- 1944,1960 ----
+ to_hex(number integer
+ or bigint)
+ text
+ Convert number to its equivalent hexadecimal
+ representation.
+
+ to_hex(9223372036854775807::bigint)
+ 7fffffffffffffff
+
+
+
translate(string
text,
***************
*** 1909,1942 ****
a23x5
-
-
- encode(data bytea,
- type text)
-
- text
-
- Encodes binary data to ASCII-only representation. Supported
- types are: 'base64', 'hex', 'escape'.
-
- encode('123\\000\\001', 'base64')
- MTIzAAE=
-
-
-
-
- decode(string text,
- type text)
-
- bytea
-
- Decodes binary data from string previously
- encoded with encode(). Parameter type is same as in encode().
-
- decode('MTIzAAE=', 'base64')
- 123\000\001
-
-
--- 1972,1977 ----
Re: new string functions doc
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Patch applied. Thanks.
---------------------------------------------------------------------------
Joe Conway wrote:
> 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 ----
>
>
>
> +
> + decode(string text,
> + type text)
> +
> + bytea
> +
> + Decodes binary data from string previously
> + encoded with encode(). Parameter type is same as in encode().
> +
> + decode('MTIzAAE=', 'base64')
> + 123\000\001
> +
> +
> +
> +
> + encode(data bytea,
> + type text)
> +
> + text
> +
> + Encodes binary data to ASCII-only representation. Supported
> + types are: 'base64', 'hex', 'escape'.
> +
> + encode('123\\000\\001', 'base64')
> + MTIzAAE=
> +
> +
> +
> initcap(text)
> text
> Converts first letter of each word (whitespace separated) to upper case.
> ***************
> *** 1829,1834 ****
> --- 1857,1874 ----
>
>
>
> + replace(string text,
> + from text,
> + to text)
> + text
> + Replace all occurrences in string of substring
> + from with substring to
> +
> + replace('abcdefabcdef', 'cd', 'XX')
> + abXXefabXXef
> +
> +
> +
>
> rpad(string text,
> length integer
> ***************
> *** 1859,1864 ****
> --- 1899,1916 ----
>
>
>
> + split(string text,
> + delimiter text,
> + column integer)
> + text
> + Split string on delimiter
> + returning the resulting (one based) column number.
> +
> + split('abc~@~def~@~ghi','~@~',2)
> + def
> +
> +
> +
> strpos(string, substring)
> text
>
> ***************
> *** 1892,1897 ****
> --- 1944,1960 ----
>
>
>
> + to_hex(number integer
> + or bigint)
> + text
> + Convert number to its equivalent hexadecimal
> + representation.
> +
> + to_hex(9223372036854775807::bigint)
> + 7fffffffffffffff
> +
> +
> +
>
> translate(string
> text,
> ***************
> *** 1909,1942 ****
> a23x5
>
>
> -
> -
> - encode(data bytea,
> - type text)
> -
> - text
> -
> - Encodes binary data to ASCII-only representation. Supported
> - types are: 'base64', 'hex', 'escape'.
> -
> - encode('123\\000\\001', 'base64')
> - MTIzAAE=
> -
> -
> -
> -
> - decode(string text,
> - type text)
> -
> - bytea
> -
> - Decodes binary data from string previously
> - encoded with encode(). Parameter type is same as in encode().
> -
> - decode('MTIzAAE=', 'base64')
> - 123\000\001
> -
> -
>
>
>
> --- 1972,1977 ----
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073