SearchStrings (FPScript)

21.09.2021

Searches in a data series for a string and returns the indices of the matches as a data series.

Syntax

SearchStrings(StringSeries, String, [ Operation = SEARCH_OP_IS ] [ , IgnoreCase = FALSE ])

 

The syntax of the SearchStrings function consists of the following parts:

Part

Description

StringSeries

The data series with strings to be searched in which to search for the string.

Permitted data structures are data series. Supported data types are string.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

String

The string for which to search.

Permitted data structures are scalar value. Supported data types are string.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Operation

Determines how the strings are compared.

The argument Operation can have the following values:

Constant

Meaning

SEARCH_OP_CONTAINS

Contains

SEARCH_OP_DOESNOTCONTAIN

Does not contain

SEARCH_OP_IS

If

SEARCH_OP_ISNOT

Is not

SEARCH_OP_STARTSWITH

Begins with

SEARCH_OP_DOESNOTSTARTWITH

Does not begin with

SEARCH_OP_ENDSWITH

Ends with

SEARCH_OP_DOESNOTENDWITH

Does not end with

SEARCH_OP_MATCHESPATTERN

Matches the specified search pattern. See details Pattern matching when searching for text.

SEARCH_OP_DOESNOTMATCHPATTERN

Does not match the specified search pattern.

SEARCH_OP_CONTAINSPATTERN

Contains the specified search pattern.

SEARCH_OP_DOESNOTCONTAINPATTERN

Does not contain the specified search pattern.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value SEARCH_OP_IS.

IgnoreCase

A Boolean value that specifies whether to ignore the case when performing a search.

Permitted data structures are scalar value. Supported data types are Boolean value.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value FALSE.

Remarks

As the result the function returns a data series of data type 64-bit integer.

The result is a data series with the indices of the found strings.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Dim names = {"Channel1", "Channel2", "Channel2", "Channel1", "Channel1", "Channel2"}
Dim data = { 1, -1, -2, 2, 3, -3 }
return data[SearchStrings(names, "Channel2")]

Returns all data values assigned to "Channel2" from a protocol.

See Also

StringFind Function

Share article or send as email:

You might be interested in these articles