How to implement search for a part of a string without letter case
a = {["hello"] = 1,["Hello"] = 2}
for i in pairs(a) do
if string.find(i, "h") then print(i)
--should be "hello" and "Hello"
Use pattern character sets, and include both cases.
local a = {
["hello"] = 1,
["Hello"] = 2
}
for i in pairs(a) do
if string.find(i, "[hH]") then
print(i)
end
end
For something more robust, see Case-insensitive Lua pattern-matching.