TRIM_CHARS

Returns the given string without leading or trailing characters.

Syntax

TRIM_CHARS(characters, input)

Arguments

NameTypeDescriptionDefault Value

characters

string

input

string

Returns

Returns a string value.


Examples

charactersinputOutput

'-='

'-==--Hello World---=---'

Hello World

'-'

''

``

'-'

'-----------'

``

'-'

'x-----------'

x

'-'

'-----------x'

x

'-'

'------x-----'

x

'-'

'x-----------x'

x-----------x

Transformation job example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
  MAP_COLUMNS_BY_NAME
    SELECT characters, input,
        TRIM_CHARS('-=', input) AS Output
    FROM default_glue_catalog.upsolver_samples.orders_raw_data
    LET characters = '-=',
        input = '-==--Hello World---=---'
    WHERE $commit_time BETWEEN run_start_time() AND run_end_time()
    LIMIT 1;

Query result

charactersinputOutput

'-='

'-==--Hello World---=---'

Hello World

Last updated