C语言-实现字符串中是否包含字串
如果包含返回0,不包含返回1
uint8_t bsp_abit_string_search(uint8_t *src, uint8_t *obj, uint8_t srclen)
{
uint8_t i = 0;
uint8_t j = 0;
uint8_t obj_size = 0;
obj_siz = strlen(obj);
if((src == NULL) || (obj == NULL))
return 1;
for(i = 0; i < srclen; i++)
{
if(src[i] == obj[0])
{
for(j = 1; j < obj_siz; j++)
{
if(src[i + j] != obj[j])
break;
}
if(j == obj_siz)
return 0;
}
if((i + relay_size) > srclen)
return 1;
}
}