查找sourcez字符串中匹配char字符串中任何字符的第一个字符
代码如下:
char *find_char(char const *source,char const *chars)
{
char *position;
unsigned int len1;
unsigned int len2;
unsigned int i;
unsigned int j;
position=NULL;
len1=strlen(source);
len2=strlen(chars);
for(i=0;i<len2;i++)
{
for(j=0;j<len1;j++)
{
if(*(source+j) == *(chars+i))
{
position=source+j;
break;
}
}
if(position!=NULL)
break;
}
return (position==NULL)?NULL:position;
}