lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Oct 27, 2014 5:55 PM, "Jain, Punit" <Punit.Jain@emc.com> wrote:
> How can I check whether a string is a hexadecimal number or not? E.g. “0x123” is a hex string, but “123” and “xyz” are not.

How about:

if (("0x123"):find("0x", 1, true)) == 1 and tonumber("0x123") then ...