Hello,
Could someone please show me how to determine if the content of a one-character string is a letter and not a number?
Thank you
determining the nature of one character
-
- Prole
- Posts: 2
- Joined: Mon Feb 17, 2014 6:11 am
Re: determining the nature of one character
Try this:
It works for multi-character strings, too.
Code: Select all
if tonumber(string) then
-- string is a number
else
-- string is something else
end
Check out my blog on gamedev
-
- Prole
- Posts: 2
- Joined: Mon Feb 17, 2014 6:11 am
Re: determining the nature of one character
Thank you that is excellent. Although it only works for identifying numbers, not letters, it's all I needed
Re: determining the nature of one character
Code: Select all
if your_string:match("%a") then
-- ...
end
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests