lua-users home
lua-l archive

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


Try to find a 0, an x, and at least one hexadecimal:

str:find("^0x%x+$")

wil return 1 when OK, nil if not
(Avoids the string copy that string:match does)

--
Oliver

Am 27.10.2014 um 16:54 schrieb Jain, Punit:

Hi All,

 

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.

 

Thanks,

Punit