Lets say:
var = "8rk3pd"
Is there a way to check if the var has letters/numbers?
Hi NiKxzsu,
local var = "8rk3pd" -- The string. print(var:match("%a+")) -- Prints 'rk' because that's the first combination of letters. %a is the string pattern for letters, and the '+' sign indicates that I want a sequence of them if possible. So, it returns rk rather than just r.
local var = "8rk3pd" -- The string. for i in string.gmatch(var, "%a+") do -- Will take the string and go through it to find sequences of letters. If you want to print each letter individually rather than sequences, you just need to remove the '+' sign. print(i) -- Prints the letter that it's iterating through. end -- end for for each iteration.
Thanks,
Best regards,
~~ KingLoneCat