Format string

Supported in: Batch, Streaming

Formats string printf style.

Expression categories: String

Declared arguments

  • Format arguments - List of args to insert into format string.
    List<Expression<Boolean | Byte | Date | Decimal | Double | Float | Integer | Long | Short | String | Timestamp>>
  • Format string - String to be formatted.
    Literal<String>

Output type: String

Examples

Example 1: Base case

Argument values:

  • Format arguments: [argument1, argument2]
  • Format string: Hello %s, my name is %s
argument1argument2Output
AliceBobHello Alice, my name is Bob
JaneJohnHello Jane, my name is John

Example 2: Base case

Description: Formats an integer. Argument values:

  • Format arguments: [4]
  • Format string: number = %d

Output: number = 4


Example 3: Base case

Description: Formats a double with a sign and 4 decimal places. Argument values:

  • Format arguments: [2.718281828459045]
  • Format string: e = %+.4f

Output: e = +2.7183


Example 4: Null case

Argument values:

  • Format arguments: [argument1, argument2]
  • Format string: Hello %s, my name is %s
argument1argument2Output
nullBobHello null, my name is Bob
AlicenullHello Alice, my name is null
nullnullHello null, my name is null