nalgeon / sqlean

The ultimate set of SQLite extensions
MIT License
3.65k stars 115 forks source link

New `text` extension #80

Closed nalgeon closed 1 year ago

nalgeon commented 1 year ago

A rich set of string functions, from slice, contains and count to split_part, trim and repeat.

Provides 25 functions, many of which are postgres-compatible.

Substrings and slicing:

text_substring(str, start [,length])
text_slice(str, start [,end])
text_left(str, length)
text_right(str, length)

Search and match:

text_index(str, other)
text_last_index(str, other)
text_contains(str, other)
text_has_prefix(str, other)
text_has_suffix(str, other)
text_count(str, other)

Split and join:

text_split(str, sep, n)
text_concat(str, ...)
text_join(sep, str, ...)
text_repeat(str, count)

Trim and pad:

text_ltrim(str [,chars])
text_rtrim(str [,chars])
text_trim(str [,chars])
text_lpad(str, length [,fill])
text_rpad(str, length [,fill])

Other modifications:

text_replace(str, old, new [,count])
text_translate(str, from, to)
text_reverse(str)

String properties:

text_length(str)
text_size(str)
text_bitsize(str)