This is the ThingsDB documentation for version v0, click here for the latest version!

str

This is the string type of ThingsDB. A value of type str should contain valid UTF-8 characters. This is not guaranteed but rather depends on MessagePack to pack data correctly. There is an is_utf8 function which can be used to test a str value for valid UTF-8 data and it is also possible to create an utf8 property on a custom Type which only allows strings with valid UTF-8 data.

Functions

Function Description
contains Determine if a given string is a substring of a string.
ends_with Determine if a string ends with characters given by another string.
len Return the length of a string.
lower Return a new string in which all case-based characters are in lower case.
replace Returns a new string in witch occurrences of a given substring or regular expression match are replaced with another substring.
split Split a string into a new list with substrings.
starts_with Determine if a string starts with characters given by another string.
test Test if a string matches a given regular expression and return true or false (deprecated, use regex.test instead).
trim Returns a new string with whitespace characters removed from both the start and end of a string.
trim_left Returns a new string with whitespace characters removed from the start of a string.
trim_right Returns a new string with whitespace characters removed from the the end of a string.
upper Return a new string in which all case-based characters are in upper case.

This code creates a raw property greet to collection stuff:

.greet = 'Hello world!!';