substr()

Table of Contents
This command is experimental.

Definition

substr() returns the substring of a given string based on the starting index and length given as arguments.

Examples

The following example returns "Hello World" for the 'n' column that is combined of two substrings. The first substring returns "Hello" and the second " World".

| makeresults
| eval string="Hello World"
| eval n=substr(string, 1, 5) + substr(string, -6)
Screenshot of the previous example’s result

Currently, substr() accepts only column references as a value. See the issue on GitHub.

Further Reading