This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
SEARCH
Dan Gorman edited this page Nov 29, 2018
·
2 revisions
SEARCH
finds the first appearance of a string within a block of text.
SEARCH(arg1, arg2, [arg3])
-
arg1
is a string to search for -
arg2
is the string to be searched -
arg3
is optional, and is the "starting" point for the string to search
Let's say we're given a response with some vehicle information that looks like this:
{
"data":{
"mechanic_reports":{
"vehicle_1":{
"description":"The car was still functional, but had a bad radiator, and was in bad condition."
}
}
}
}
If we know that the description
attribute is going to have a standard structure and used standardized terminology, we can do a search for, let's say, "bad":
SEARCH("bad", data.mechanic_reports.vehicle_1.description)
This would return 41
- which is the position in the string at which our arg1
first appears.
We can also add the third, optional argument, to search after a specific starting point, like this:
SEARCH("bad", data.mechanic_reports.vehicle_1.description, 41) => 66