Re: parse hex numerals [PATCH]
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: parse hex numerals [PATCH]
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2006年2月09日 13:11:19 -0200
What about this?
char *endptr;
*result = lua_str2number(s, &endptr);
if (endptr == s) return 0; /* conversion failed */
+ if (*endptr == 'x') *result = strtoul(s, &endptr, 16);
if (*endptr == '0円') return 1; /* most common case */
while (isspace(cast(unsigned char, *endptr))) endptr++;
if (*endptr != '0円') return 0; /* invalid trailing characters? */
-- Roberto