Product Solutions Support
Try MemSQL

TRIM

Removes padding from the ends of the given string.

TRIM ([[BOTH | LEADING | TRAILING] [padding] FROM] str)

Arguments

If no keyword is specified, defaults to BOTH.

Return Type

String

Examples

Info

This function removes only space “ ” characters. Other whitespace characters like tab \t, newline \n, etc are preserved.

memsql> select trim('    ohai     ') as t,
    -> trim(LEADING FROM '    ohai     ') as l,
    -> trim(TRAILING FROM '    ohai     ') as r;
+------+-----------+----------+
| t    | l         | r        |
+------+-----------+----------+
| ohai | ohai      |     ohai |
+------+-----------+----------+

memsql> select trim("abra" FROM "abracadabra") as t;
+------+
| t    |
+------+
| cad  |
+------+
Was this article useful?