FindStr

Not available in this language yet.
FindStr( value, find, [start] )
FindStr( value, find, [start] )
FindStr( value, find, [start] )
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
FindStr( value, find, [start] )

Description

The FindStr function returns the offset position of a string in another string, or -1 if the string is not found.

Parameters

Argument Type Definition and Requirements

value

String

The string to search in.

find

String

The string to search for.

start

String

Optional - The position in the value string where the search starts. The default value, if omitted, is 0 code points. The first position in the string is 0. If the value is less than 0, then the start value is ignored.

Returns

A integer value of where the find string starts. If the find string is not found in the value string, then -1 is returned.

Examples

The query below executes an array of independent FindStr operations and returns the results in an array. The result array position matches the execution array position. The first operation takes a string to search ("fire and fireman"), locates the first occurrence of the search string "fire", and places the offset in the top position of the result array. The second operation uses the same search string ("fire and fireman") and attempts to locate the first occurrence of the word "fire" after the fourth character in the string. The result of 9 is placed into the second position of the result array.

System.out.println(
  client.query(
    Arr(
       FindStr("fire and fireman", "fire"),
       FindStr("fire and fireman", "fire", 4)
    )
  ).get());
[0, 9]