首页 > 其他 > 详细

删除字符串头部的空白字符

时间:2016-01-22 22:02:25      阅读:136      评论:0      收藏:0      [点我收藏+]
#include <stdio.h>
#include <string.h>

 //删除字符串头部的空白字符。
int main()
{
	char code[]="        hello  World";		//
	int len=sizeof(code);

	char buf[16];
	int count=0;
	int i=0;
	for(i=0;i<len;i++)
	{
		if(code[i]==‘ ‘)
		{																				   					  
				continue;																				 
		}																																	 
		else
		{
		   for(int j=i;j<len;j++)				  
		   {
			   buf[count++]=code[j];																  
		   }
		   break;
		}																								 
	}	

	return 0;
}

  

#include <stdio.h>
#include <string.h>

 //删除字符串头部的空白字符。
int main()
{
    char code[]="        hello  World";        //
    int len=sizeof(code);

    char buf[16];
    int count=0;
    int i=0;
    for(i=0;i<len;i++)
    {
        if(code[i]== )
        {                                                                                                         
                continue;                                                                                 
        }                                                                                                                                     
        else
        {
           for(int j=i;j<len;j++)                  
           {
               buf[count++]=code[j];                                                                  
           }
           break;
        }                                                                                                 
    }    

    return 0;
}

 

删除字符串头部的空白字符

原文:http://www.cnblogs.com/Shenniu/p/5152286.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!