www.pudn.com > ucos_shell.rar > mystring.c


//********************************************************************************** 
//杨屹    2002/08/20    第一版 
//字符串操作函数 
//联系方法:gdtyy@ri.gdt.com.cn(2003/07/31以前有效) 
//********************************************************************************** 
//使用方法: 
//自包含 
//与标准库函数用法相同。 
//********************************************************************************** 
#include  
 
void yystrlwr(unsigned char *str)//将字符串全部转换成小写格式 
{ 
	int i; 
	unsigned char ch; 
	for(i=0;1;i++){ 
		ch=*(str+i); 
		if(ch=='\0') break; 
		else if(ch>='A'&&ch<='Z') *(str+i)=ch-'A'+'a'; 
	}	 
} 
 
char yystrcmp(unsigned char *stra,unsigned char *strb)//比较a和b两个字符串的大小,a>b 1 a=b 0 achb) return 1; 
		else if(cha'9')&&(ch<'a'||ch>'z')&&(ch<'A'||ch>'Z')) return 0; 
			else{ 
				if(ch>='0'&&ch<='9') x=x*16+(ch-'0'); 
				else if(ch>='a'&&ch<='z') x=x*16+(ch-'a'+10); 
				else x=x*16+(ch-'A'+10); 
				//x=x*10+(ch-'0'); 
			} 
			i=i+1; 
			ch=Str[i]; 
		} 
		if(i'9') return 0; 
			else x=x*10+(ch-'0'); 
			i=i+1; 
			ch=Str[i]; 
		} 
		if(i'9')&&(ch<'a'||ch>'z')&&(ch<'A'||ch>'Z')) return 0; 
		else{ 
			if(ch>='0'&&ch<='9') x=x*16+(ch-'0'); 
			else if(ch>='a'&&ch<='z') x=x*16+(ch-'a'+10); 
			else x=x*16+(ch-'A'+10); 
		} 
		i=i+1; 
		ch=Str[i]; 
	} 
	if(i