#lua question: If I want to check whether all the characters in a string are upper case, (so that it returns `true`), how do I go about doing this?
-
#lua question: If I want to check whether all the characters in a string are upper case, (so that it returns `true`), how do I go about doing this?
My initial thought is
`function uc(inp)
if string.match(inp, "%u") and inp ~= string.match(inp, "%l") then
return true
else
return false
end
end
`And this returns true for "H" and false for "h", but true for "Hh"...
any ideas?
#programming #question #learning -
#lua question: If I want to check whether all the characters in a string are upper case, (so that it returns `true`), how do I go about doing this?
My initial thought is
`function uc(inp)
if string.match(inp, "%u") and inp ~= string.match(inp, "%l") then
return true
else
return false
end
end
`And this returns true for "H" and false for "h", but true for "Hh"...
any ideas?
#programming #question #learningJectoons :krita: :debian: you can convert the string to upper case and see if it's changed
-
undefined rag. Gustavino Bevilacqua ha condiviso questa discussione
undefined Oblomov ha condiviso questa discussione