REPLACE

fun REPLACE(column: KQLiteColumn<*>, oldValue: String, newValue: String): KQLiteColumn<String>

Replaces all occurrences of a specified substring with another substring.

This function corresponds to the replace(X, Y, Z) function in SQLite. It returns a string formed by substituting the string newValue for every occurrence of the string oldValue in the string from column.

The search is case-sensitive. If oldValue is an empty string, the behavior is undefined. If any of the arguments are NULL, the result is NULL.

Example

// SELECT replace('hello world', 'world', 'KQLite') -> 'hello KQLite'
// Using a column:
val updatedDescription = select(REPLACE(Products.description, "old_feature", "new_feature"))
.from(Products)

Return

A KQLiteColumn of type String containing the modified string.

Author

MOHAMMAD AZIM ANSARI

Parameters

column

The column or string value to be modified.

oldValue

The substring to be replaced.

newValue

The substring to substitute for oldValue.

See also