lua-users home
lua-l archive

Re: Help with sting compare?

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Philippe,
read.io() gets one line from the current file, or standard input.
I am now using string.sub(aline,1,1) and string.sub(aline,1,2) to be sure I only check the first and second characters of the string aline... still it does not detect "&" or "&&"
Adrian,
I have put "local aline" at the beginning of the outermost loop, that did not fix it either.
I am printing out the substring of aline...
print(">" .. string.sub(aline,1,1) .. "<")
and I get:
>&<
So aline has the character I am looking for, is == valid with strings?
I have also tried testing with '&' and enclosing the test in parens like C
if ( string.sub(aline,1,1) == "&") then....
I am using Lua 5.0.2....
Thanks for your help so far...
Ron.

AltStyle によって変換されたページ (->オリジナル) /