applyFormat

Full name: taxi.stdlib.applyFormat

Signature

declare extension function applyFormat(input: Any, format: String):String

Description

Applies a format string to the input value using Java Formatter conventions.

Accepts any value (string, number, date, etc.) as input. The format string controls width, padding, precision, and alignment.

// Zero-pad an integer to 6 digits
find { order: Order } as {
   paddedId: order.id.applyFormat('%06d')
}

Examples

Formats an integer with zero-padding using %05d.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed

Left-justifies a string in a 10-character wide field using %-10s.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi