A little problem with StrSearch - Forum

Forum Navigation
You need to log in to create posts and topics.

A little problem with StrSearch

HI,
I think I found a little problem with strSearch. See the following code snippet.

setvar [stringToSearch] "abc"
setvar [sourceString] ""

StrSearch "[stringToSearch]" "[sourceString]" [result]
typeof [result] [typeOfResult]
jsalert "Result is: [result] and type of result is:[typeOfResult]"

If the string to search ([sourceString]) is empty, the search does not return -1 (as you would expect) but returns an empty string. This could lead to malfunctions.
I hope it helps someone.

Greetings
Rocco

luishp has reacted to this post.
luishp

Hi @roccocogliano, thank you!
I will try to fix it for the next update.

Regards.

roccocogliano has reacted to this post.
roccocogliano