number=0;
k=0;
for(i=0;s[i]!='\0';i++)
{
ch=s[i];
if(ch>='0'&&ch<='9'||ch>='a'&&ch<='f'||ch>='A'&&ch<='F')
num[k++]=ch;
}
num[k]='\0'
for(i=0 ;num[i]!='\0',i++)
{
ch=num[i];
if(ch>='0'&&ch<='9')
number=numbe*16+ch-'0';
else if(ch>='a'&&ch<='f')
number=number*16+ch-'a';
else if(ch>='A'&&ch<='F')
number=number*16+ch-'A';
}
/* --- */ 部分:
i = 0; k = 0;
while(str[i] != 0)
{
ch = str[i];
if ( (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F') || (ch >= '0' && ch <= '9') )
{
str[k] = ch;
++k;
}
++i;
}
str[k] = 0;
sscanf(str, "%x", &number);