La nuova BBS è in fase Alpha. I post precedenti al 22 luglio 2024 potrebbero non essere trasferibili, ma rimarranno disponibili per la lettura su /old/.
#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 -
@jectoons@comicscamp.club you can convert the string to upper case and see if it's changed
-
G gustavinobevilacqua@mastodon.cisti.org shared this topic