?? lstring.cpp
字號:
#ifndef LSTRING_CPP
#define LSTRING_CPP
#define LD_MAX_LIST_LEN 200
short lArrangeStr(char *source,char *dest);
static char lCheckChar(char c);
static short list[LD_MAX_LIST_LEN][2];
short lArrangeStr(char *source,char *dest)
{ register char *p0,*p1;
short i,j,count,done=0;
for (i=0;i<LD_MAX_LIST_LEN;i++) list[i][0]=0,list[i][1]=0;
p0=source; p1=p0; i=0;
while (!done) {
while (*p1==' '&&*p1!=0) p1++; p0=p1; // Skip space
if (*p1=='\'') {
p1++; while(*p1!='\''&&*p1!=0) *p1++;
if (*p1=='\'') p1++; list[i][0]=p0-source; list[i][1]=p1-p0;
i++; p0=p1;
}
switch (lCheckChar(*p1)) { // Get form
case 2: list[i][0]=p1-source; list[i][1]=1;
p1++; p0=p1; i++; break;
case 1: while (lCheckChar(*p1)==1) p1++;
list[i][0]=p0-source; list[i][1]=p1-p0;
p0=p1; i++; break;
case 0: done=1; break;
}
}
count=i; p1=dest;
for (i=0;i<count;i++) {
for (j=0;j<list[i][1];p1++,j++) *p1=source[list[i][0]+j];
if (i!=count-1) { *p1=' '; p1++; }
}
*p1=0;
return count;
}
static char lCheckChar(char c)
{ if (c==0) return 0;
if (c==' ') return 3;
if ( (c>='a'&&c<='z') || (c>='A'&&c<='Z') ||
(c>='0'&&c<='9') || (c=='_') ) return 1;
return 2;
}
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -