Am 19.08.2016 um 16:27 schrieb Allin Cottrell:
On Fri, 19 Aug 2016, Sven Schreiber wrote:
How about if we emulated C (sort of) and allowed empty and non-empty
strings to evaluate as 0 and 1 where the context requires a Boolean
result? Then you could just say
if strstr(s1, "USA")
# something
else
# something else
endif
Looks good at first sight. But I certainly don't want to slow down the
parser.
BTW, the name of the 'strstr()' itself strikes me as unintuitive. I
often find myself mistaking 'strsub()' for 'strstr()', because the
"sub"
reminds me of "substring" whereas in reality it comes from
"substitute".
So if you allow me to dream on for a second, 'strsubst()' instead of
'strsub()' would be good, and 'strstr()' could become
'strfind()'.
So then the above would become:
if strfind(s1, "USA")
# something
...
Now wouldn't that be nice, hehe?
cheers,
sven