String calculated fields, except for sortinterval, allow you to edit texts to get different results.
Remember to always include strings between quotation marks (" ").
The functions included in the String category are:
The find function returns the starting position of a first string in a second string as specified in your arguments.
There are three arguments you need to configure:
text: the text you want to find.
within text: the text in which you want to carry out the search.
start number: the character from which you want to start looking.
Let’s take a look at the sample included in the table above:
The search will start in the first t of Getting. The resulting 15 is the character number where the w in with is located.
If with were repeated more than once in the phrase, the calculated field will return the character of the first occurrence of the word.
The mid calculated field returns a substring of the specified string according to what you configure in your arguments.
There are three parameters for you to configure:
text: the text you want to select the string from.
start: the character where you want to start your new substring.
length: the length of your substring.
Let’s take a look at the sample included in the table above:
The output is Started with because of what is in the text string starting at character 9 and lasting 12 characters:
The replace function replaces a given string with a different one as specified in your arguments.
There are three arguments for you to configure:
text: the original, complete, string of text.
old text: the string you want to replace.
new text: the text you want to replace your old string with.
Let’s look at the following sample:
Note that the old text got replaced both times; make sure you consider that the term will be changed every time it appears before you change it.
The sortinterval function returns a value in a(n) interval(s) according to what is configured in the arguments.
The format for the returned string will be NN [from, to].
Let’s look at one of the samples in the table above:
In this case, the Wage is being compared against one value, and classified in two different categories: higher than 150K and lower than 150K.
In the following example, however, Wage is compared against four different values, and is classified into five different categories: lower than 50K, between 50K and 80K, between 80K and 110K, between 110K and 140K, and higher than 140K.