It seems, there is nothing special
about strstr:
if "abc"
print "abc"
endif
if (1 == 1) && "abc"
print "nothing"
endif
if (1 == 1) && strlen("abc")
print "wow!"
endif
It looks like 'if' can evaluate non-empty string
alone as 1 but can't evaluate logical expressions
with string input
if "a"
print "a"
endif
if "b"
print "b"
endif
if "a" || "b"
print "a or b"
endif
if "a"~"b"
print "a~b"
endif
Oleh
8 березня 2018, 10:29:01, від "Sven Schreiber" <svetosch(a)gmx.net>:
Hi,
see this:
<hansl>
if strstr("abc", "a")
print "yes"
endif
if (1 == 1) && strstr("abc", "a") != ""
print "aha"
endif
if (1 == 1) && strstr("abc", "a")
print "oho"
endif
</hansl>
The last thing gives an error, where I would expect that if the first
variant works, then so should the third/last one. Workaround is the
second explicit thing, obviously.
thanks,
sven
_______________________________________________
Gretl-devel mailing list
Gretl-devel@lists.wfu.eduhttp://lists.wfu.edu/mailman/listinfo/gretl-devel