Bill,

A digit is just 0 to 9, per the definition of isdigit.  Masking off the sign 
extension of the char value will just keep the values from 0 to 255 - UTF-8 
sequences will have bit 7 set which will prevent isdigit from matching.


On Dec 7, 2011, at 11:09 PM, Bill Spitzak wrote:
> On 10/18/2011 11:43 AM, Michael Sweet wrote:
>> In this case I would not use strtol to skip digits, but a simple while loop 
>> instead:
>> 
>>     while (isdigit(*str&  255))
>>       str ++;
>> 
>> (the "&  255" part is necessary to avoid portability issues with UTF-8 
>> strings)
> 
> That seems wrong. That will actually turn some parts of UTF-8 characters 
> into digits and thus match. You actually do not want to change the 
> bytes, all the bytes in a multi-byte UTF-8 character will fail the 
> isdigit() test and thus this will stop at that point.
> 
> _______________________________________________
> fltk-dev mailing list
> fltk-dev@easysw.com
> http://lists.easysw.com/mailman/listinfo/fltk-dev

_____________
Michael Sweet

_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to