易截截图软件、单文件、免安装、纯绿色、仅160KB

自己整理的关于C的一些字符串处理函数

鉴于在用C语言写一些字符串处理的程序时种种的不便,本人坚信"磨刀不误砍柴功"这个信条,于是在专门
进行了一次磨对C语言的磨刀,写了一些字符串的处理函数, 方便网友使用, 大家有好的解决方法也请告知一下.
    我估计有一些C的库中肯定有比我这更好的函数, 但是本人没有找到, 望"行家"告知.
#include <string.h>
/********************************************************
    返回字符ch在head字符串中首次出现的位置
********************************************************/
int indexString(char* head, char ch)
{
    int i=0;
    int flag=0;
    while(head[i]!=0)
    {
        if(head[i] == ch)
        {
            flag=1;
            break;
        }
        i++;
    }
    if(flag)
        return i;
    else
        return -1;
}
/********************************************************
    求子字符串的函数:取字符串head中从start位置到end
    位置处的字符串,如head="hello world xphag",
    subString(head, 0, strlen(head)-1)的结果为"hello world xphag"
    subString(head, 0, 0)的结果为"h"
********************************************************/
char* subString(char* head, int start, int end)//取字符串的start位置到end位置的子字符串(含start),失败返回NULL
{
    int i=0, j=0;
    i=strlen(head);
    if(start>=i || end>= i || start> end)
        return NULL;
    char* p=(char* )malloc(sizeof(char)* (end-start+2));
    for(i=start; i<=end; i++ )


相关文档:

样例解析_C盘防毒批处理.bat

@echo off
@echo ╔┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╗
@echo ┋ 心 如 止 水 ┋
@echo ┋ ┋
@echo ┋ DIY 个 性 BAT C 盘 防 毒 批 处 理 ┋
@echo ┋ ......

C/S模式与B/S模式的比较分析

一、C/S模式与B/S模式的比较分析
  C/S模式主要由客户应用程序(Client)、服务器管理程序(Server)和中间件(middleware)三个部件组成。客户应用程序是系统中用户与数据进行交互的部件。服务器程序负责有效地管理系统资源,如管理一个信息数据库,其主要工作是当多个客户并发地请求服务器上的相同资源时,对这些资源进行最 ......

c指针

c指针的运算有时候还是很迷惑人的。
例如:
struct student {
int num;
int score;
int length;
};
struct student *pt;
pt = (struct student *) malloc(sizeof(struct student));
pt->num = 1;
pt->score = 90;
pt->length = 3 * sizeof(int);
printf("pt length:%d\n", *pt);
pt = (int ......

C中的可变参数研究

一. 何谓可变参数
int printf( const char* format, ...);
这是使用过C语言的人所再熟悉不过的printf函数原型,它的参数中就有固定参数format和可变参数(用”…”表示)。
而我们又可以用各种方式来调用printf,如:
printf("%d",value);
printf("%s",str);
printf("the number is %d ,st ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号