Action()
{
char str[]={"testroad"};
char c='t';
//strchrTest调用函数
lr_output_message("%s",strchrTest(str,c));
return 0;
}
char *strchrTest(char *ptr, char c){
char *p=ptr;
char *p1=ptr;
if(ptr !=NULL){ //异常处理
while(*ptr !='\0'){ //移动指针到字符串尾
ptr++;
}
while(ptr !=p1){ //逆向查找指定字符
if(*ptr == c)
{
p=ptr;
break;
}
ptr--;
}
}
//实现大写到小写的转化;
if((*p>='A')&&(*p<='Z')){
}
else if ((*p>='a')&&(*p<='z')){
*p=*p - 32;
}else{
lr_output_message("%c不是字母",c);
}
//lr_output_message("%s",ptr);
return p;
}
{
char str[]={"testroad"};
char c='t';
//strchrTest调用函数
lr_output_message("%s",strchrTest(str,c));
return 0;
}
char *strchrTest(char *ptr, char c){
char *p=ptr;
char *p1=ptr;
if(ptr !=NULL){ //异常处理
while(*ptr !='\0'){ //移动指针到字符串尾
ptr++;
}
while(ptr !=p1){ //逆向查找指定字符
if(*ptr == c)
{
p=ptr;
break;
}
ptr--;
}
}
//实现大写到小写的转化;
if((*p>='A')&&(*p<='Z')){
}
else if ((*p>='a')&&(*p<='z')){
*p=*p - 32;
}else{
lr_output_message("%c不是字母",c);
}
//lr_output_message("%s",ptr);
return p;
}