FORMAT

fun FORMAT(format: String, vararg columns: KQLiteColumn<*>): KQLiteColumn<String>

Formats a string using a format template and a variable number of arguments.

This function is similar to printf but with some key differences in how format specifiers are handled. It formats the string according to the format argument, which can contain substitution markers like %d, %s, etc. These markers are replaced by the values from the subsequent arguments (x, xn).

Unlike printf, format() will reuse arguments to satisfy all format specifiers if there are more specifiers than arguments. For example, format('%s %s', 'a') results in 'a a'.

Example

// SELECT format('Hello, %s! Your ID is %d.', name, id) FROM Users
val query = select(FORMAT("Hello, %s! Your ID is %d.", Users.name, Users.id)).from(Users)

Return

A KQLiteColumn of type String containing the formatted result.

Author

MOHAMMAD AZIM ANSARI

Parameters

format

The format string containing substitution specifiers.

columns

Columns or values for substitution.

See also