substr

To return a new string out of a given text

This function extracts a part of a text according to your specifications.

You need to provide the start position, where the extract in the given text shall begin, and (optional) the length of the extract. If you don’t specify the length, the extract will run until the end of the given text. The start is zero-based.

This function helps you to extract parts of identically structured data, for example, invoice numbers; or you can abbreviate values for comparison, for example, Yes and No, which could be shortened to Y and N.

Syntax

substr(string, number)

substr(string, number, number)

Return

string

Examples

substr(text, start) To return a new string out of a given text with a given start. The start is zero-based.

substr('Ninox example', 11)

Result: !

(with the field Ninox example containing the text Hello world!)

substr(text, start, length) To return a new string of a given length out of a given text with a given start. The start is zero-based.

substr('Ninox example', 0, 5) 

Result: Hello

(with the field Ninox example containing the text Hello world!)

See also

extractx, which extracts a string from a given text using a regular expression.

substring, which returns a new string out of a given text with a given start and a given end.

Last updated