SqlLike

object SqlLike

SQL LIKE helpers for ContentResolver selections.

Functions

Link copied to clipboard
fun escape(value: String): String

Escapes \, % and _ in value so it matches literally inside a LIKE pattern. Pair it with ESCAPE '\' in the selection, e.g. "$COLUMN LIKE ? ESCAPE '\\'" with the argument "%${SqlLike.escape(query)}%".