Important Update to Custom Scripting
SurveyGizmo's CustomScript Action now supports the LUA programming language. Visit our NEW Lua Scripting Resources!
Legacy Custom Scripting Language Deprecation Plans
- New accounts (created after October 29, 2018) will only have the option to use Lua in scripts.
- As of October 29, 2018 Custom Scripting Actions will default to Lua as the scripting type in the Custom Scripting Action for accounts created before this date. You will be able to switch to the Legacy Custom Scripting; though we highly encourage using Lua.
- In the long term, Legacy Custom Scripting Actions will be switched to read-only. The exact date on this is to be determined; we will send notifications well ahead of time.
This is equivalent to the strpos function in PHP. This function returns the numeric position of the first occurrence of %%needle string in the %%haystack string. If the optional %%offset parameter is specified, the search will start this number of characters counted from the beginning of the string. Offset cannot be negative.
The below example would return the numeric position 0.
%%haystack = 'abc'; %%needle = 'a'; %%output .= sgapiStrPos(%%haystack, %%needle);
The below example uses the offset parameter to ignore the first instance of the needle 'a.' This would return the numeric position 4.
%%haystack = 'abc abc'; %%needle = 'a'; %%output .= sgapiStrPos(%%haystack, %%needle, %%offset = 1);
To see an example or learn more other PHP functions and PHP programming, visit PHP Documentation.