再来几个函数
#define LOG2 0.301
const double EXP10[]={1,1e1,1e2,1e3,1e4,1e5,1e6,1e7,1e8,1e9,
1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17,1e18,1e19,
1e20,1e21,1e22,1e23,1e24,1e25,1e26,1e27,1e28,1e29,
1e30,1e31,1e32,1e33,1e34,1e35,1e36,1e37,1e38,1e39};
//---------------------------------------------------------------
char *StrLower_ch;
char *StrLower(char *s)
{
int i=0;
free(StrLower_ch);
StrLower_ch=(char *)malloc(strlen(s)+1);
while (s!='\0')
{
if(s>=65&&s<=90)
{
StrLower_ch=s+32;
}
else
{
StrLower_ch=s;
}
i++;
}
StrLower_ch='\0';
return StrLower_ch;
}
//---------------------------------------------------------------
char *StrUpper_ch;
char *StrUpper(char *s)
{
int i=0;
free(StrUpper_ch);
StrUpper_ch=(char *)malloc(strlen(s)+1);
while (s!='\0')
{
if(s>=97 && s<=122)
{
StrUpper_ch=s-32;
}
else
{
StrUpper_ch=s;
}
i++;
}
StrUpper_ch='\0';
return StrUpper_ch;
}
//---------------------------------------------------------------
char * StrLeft_ch;
char * StrLeft(char *s,int Len)
{
int i;
free(StrLeft_ch);
StrLeft_ch=(char *)malloc(Len+1);
for( i=0;i<Len;i++)
{
StrLeft_ch=s;
if (s=='\0')
{
break;
}
}
StrLeft_ch='\0';
return StrLeft_ch;
}
//---------------------------------------------------------------
char * StrRight_ch;
char * StrRight(char *s,unsigned int Len)
{
int i=0,k=0;
free(StrRight_ch);
StrRight_ch=(char *)malloc(Len+1);
if(strlen(s)>=Len)
{
i=strlen(s)-Len;
}
while(s!='\0')
{
StrRight_ch[k]=s;
i++;
k++;
}
StrRight_ch[k]='\0';
return StrRight_ch;
}
//---------------------------------------------------------------
char * StrMid_ch;
char * StrMid(char *s,unsigned int Pos,unsigned int Len)
{
unsigned int i=0,k=0;
free(StrMid_ch);
StrMid_ch=(char *)malloc(Len+1);
if(strlen(s)<=Pos)
{
StrMid_ch[0]='\0';
}
else
{
i=Pos;
while(s!='\0' && (k<Len||Len==0))
{
StrMid_ch[k]=s;
i++;
k++;
}
StrMid_ch[k]='\0';
}
return StrMid_ch;
}
//---------------------------------------------------------------
char *StrAdd_ch;
char *StrAdd(char *s1,char *s2)
{
unsigned int i,k=0;
free(StrAdd_ch);
StrAdd_ch=(char *)malloc(strlen(s1)+strlen(s2));
for (i=0;i<strlen(s1);i++)
{
StrAdd_ch[k++]=s1;
}
for(i=0;i<strlen(s2);i++)
{
StrAdd_ch[k++]=s2;
}
StrAdd_ch[k]='\0';
return StrAdd_ch;
}
//---------------------------------------------------------------
char *IntToStr_ch;
char *IntToStr(int x)
{
char ch;
unsigned int i=0,Sign=0,k=0;
free(IntToStr_ch);
IntToStr_ch=(char *)malloc(6);
if (x<0)
{
x=-x;
IntToStr_ch[k++]='-';
Sign=1;
}
while(x>0)
{
IntToStr_ch[k++]=(x%10)+'0';
x=x/10;
}
if(k==0)
{
IntToStr_ch[k++]='0';
}
for(i=0;i<(k-Sign)/2;i++)
{
ch=IntToStr_ch[Sign+i];
IntToStr_ch[Sign+i]=IntToStr_ch[k-1-i];
IntToStr_ch[k-1-i]=ch;
}
IntToStr_ch[k]='\0';
return IntToStr_ch;
}
//---------------------------------------------------------------
char *LongToStr_ch;
char *LongToStr(long x)
{
char ch;
unsigned int i=0,Sign=0,k=0;
free(LongToStr_ch);
LongToStr_ch=(char *)malloc(11);
if (x<0)
{
x=-x;
LongToStr_ch[k++]='-';
Sign=1;
}
while(x>0)
{
LongToStr_ch[k++]=(x%10)+'0';
x=x/10;
}
if(k==0)
{
LongToStr_ch[k++]='0';
}
for(i=0;i<(k-Sign)/2;i++)
{
ch=LongToStr_ch[Sign+i];
LongToStr_ch[Sign+i]=LongToStr_ch[k-1-i];
LongToStr_ch[k-1-i]=ch;
}
LongToStr_ch[k]='\0';
return LongToStr_ch;
}