其他分享
首页 > 其他分享> > C语言字符串截取

C语言字符串截取

作者:互联网

#include <stdio.h>
#include <string.h>
int main ()
{
   char str[] = "http://www.runoob.com";
   char ch = '.';
   char *ret = NULL;
   ret = strchr(str, 'r');
   if ( ret == NULL )
   {
        printf("aaaa\n");
   }
   else
   {
        if ( strlen(ret+1) == 0 )
        {
                printf("ccc\n");
        }
        printf("[%s]\n",ret+1);
   }
   printf("%d\n",strlen("${agent_id}:"));
   return(0);
}

 

 

strstr strchr

标签:strchr,截取,ret,C语言,char,printf,字符串,NULL,strlen
来源: https://www.cnblogs.com/yueers/p/16398194.html