On Mon, 4 Apr 2022, Fred Engst wrote:
Hi Allin and others on the gretl team,
I tried to find a simple string function similar to OX’s strfind()
function, or Excel’s find() function, that gives me the position
of a text string in another text string and couldn’t seem to find
one.
All the functions in the “Strings” section gives something else
then what I want, it seem.
There isn't a built-in function that gives you exactly the match
position of one string in another, but the strstr() function can be
used for that purpose, as in
<hansl>
string s = "What's in a name?"
string p = strstr(s, "name")
if s != ""
printf "found at offset %d\n", strlen(s) - strlen(p)
endif
</hansl>
Allin