Links

STRING_FORMAT

Format any number of inputs into a string using the given format

Syntax

STRING_FORMAT(formatString, inputs1[, inputs2, ..., inputsN])

Arguments

Name
Type
Description
Default Value
formatString
string
The format string where {n} prints the n'th input. For example, the pattern '{0}.{0}.{1}' on the inputs 'a' and 'b' will result in the string 'a.a.b'
null
inputs#
any

Returns

string

Examples

formatString
inputs1
inputs2
inputs3
Output
'{0} {1} {2}'
'a'
'b'
'c'
a b c
'{0}'
1.23
1.23
'{0,number,percent}'
0.5
50%
'{0,number,#.###}'
1.23456
1.235
'{0,number,#.###}'
1.2
1.2
'{0,number,0.000}'
1.23456
1.235
'{0,number,0.000}'
1.2
1.200
'{0,number,###,###.###}'
123456789.01235
123,456,789.012
'{0,number,000,000.000}'
123456789.01235
123,456,789.012

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 formatString, inputs1, inputs2, inputs3,
STRING_FORMAT('{0} {1} {2}', inputs1, inputs2, inputs3) AS Output
FROM default_glue_catalog.upsolver_samples.orders_raw_data
LET formatString = '{0} {1} {2}',
inputs1 = 'a',
inputs2 = 'b',
inputs3 = 'c'
WHERE time_filter()
LIMIT 1;

Query result

formatString
inputs1
inputs2
inputs3
Output
'{0} {1} {2}'
'a'
'b'
'c'
a b c
Last modified 5mo ago