Search Substring (Expression Function)

Purpose

The Search Substring function (SEARCH_SUBSTRING) is used to find the index of a search string found within another string. The search is case sensitive.

Parameters

The Search Substring function has four parameters, two of which are required:

Find

Allowed Inputs: field value or text string

The first required parameter of the Search Substring function is the string that we are looking for. Either use the use the Query Builder to choose a field that contains the search value or use type a value to search for a text string.

Within

Allowed Inputs: field value or text string

The second required parameter is the string that is being search. It can either be obtained from a field using the Query Builder or from a literal string.

Occurrence

Allowed Inputs: field value or a positive number

The third parameter, which is optional, is a number denoting which occurrence of the search value to return the index for. If this option is not used then the first occurrence is used.

Start Point

Allowed Inputs: omitted or “end”

The fourth parameter, which is optional, is a string used to determine from which end of the string the search starts. If this parameter is omitted then the search will proceed left to right. If the parameter is set to “end” then the search will be performed right to left. If this parameter is used then the third parameter will need to be entered.

Output

The output of the Search Substring function is a number representing the index of the left hand side of the searched string relative to the left hand side of the string being search starting at zero.

Example

Searches are case sensitive for example SEARCH_SUBSTRING(“T”,“This is a String') will return 0 while SEARCH_SUBSTRING(“t”,”This is a String') will return 11. The index returned is always relative to the left hand side of the string for example SEARCH_SUBSTRING(“i”,“This is a String',1,'end') returns 13 and SEARCH_SUBSTRING(“i”,”This is a String',1) returns 2.

expression function - search substring.txt · Last modified: 2016/09/14 14:19 (external edit)
Copyright WorkXpress, 2018