PostgreSQL/String Functions/btrim — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 10:13, 26 мая 2010

btrim("123example 332", "123")

postgres=#
postgres=# SELECT btrim("123example 332", "123") AS trim_numbers;
 trim_numbers
--------------
 example
(1 row)
postgres=#



btrim(s [, t]): Returns character string s

postgres=# -- btrim(s [, t]): Returns character string s, trimmed on the left and right 
of any substrings consisting solely of letters in character string t 
(or whitespace, if t is not specified)
postgres=#
postgres=# SELECT btrim("  whitespace example   ") AS trim_blanks;
    trim_blanks
--------------------
 whitespace example
(1 row)
postgres=#
postgres=#



Remove the longest string consisting only of bytes in bytes from the start and

postgres=#
postgres=# -- btrim(string bytea, bytes bytea)
postgres=# -- Remove the longest string consisting only of bytes in bytes from the start and
postgres=# -- end of string
postgres=#
postgres=# select btrim("\\000trim\\000"::bytea, "\\000"::bytea);
 btrim
-------
 trim
(1 row)
postgres=#
postgres=#