You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.
The behaviour you observe is by design. That is, if the substring is not found string.locate returns an undefined value. If you want your code to handle such a case, you would do something like:
echo string.locate("Test", "Ta") ? "UNDEFINED"
or if you want to assign the (undefined) result to a variable
A string.locate which does not find the string to locate throws an error in gsl e.g.:
create.gsl
The output is:
Is there an option to catch this error or to return -1 instead?
The error message is also not very helpful. It should be something like:
The text was updated successfully, but these errors were encountered: