FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. For more details, review the migration guide. Contact support@fauna.com with any questions. |
FindStr
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
FindStr( value, find, [start] )
find_str( value, find, [start] )
FindStr( value, find, [start] )
FindStr( value, find, [start] )
FindStr( value, find, [start] )
Description
The FindStr
function returns the offset position of a string within
another string, or -1 if the string is not found.
Parameters
Parameter | Type | Definition and Requirements | ||
---|---|---|---|---|
|
String |
The String to search in. |
||
|
String |
The String to search for. |
||
|
Integer |
Optional - The position in the
|
Returns
A Integer indicating the position where the find
string
starts. If the find
string is not found in the value
string, -1 is
returned.
Examples
The following query 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 first 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.
[ 0, 9 ]
[0, 9]
[0 9]
Arr(LongV(0), LongV(9))
[ 0, 9 ]
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!