适配3码互转算法
This commit is contained in:
@@ -137,7 +137,7 @@ static int str_ainttoi(const char *s)
|
||||
}
|
||||
return ret*sig;
|
||||
}
|
||||
static int str_ahextoi(const char *s)
|
||||
int str_ahextoi(const char *s)
|
||||
{
|
||||
int ret=0;
|
||||
while(*s)
|
||||
@@ -164,7 +164,7 @@ static int str_ahextoi(const char *s)
|
||||
}
|
||||
int str_atoi(const char *s)
|
||||
{
|
||||
if(s[0]=='0'&&s[1]=='x'){
|
||||
if(s[0]=='0'&&((s[1]=='x')||(s[1]=='X'))){
|
||||
return str_ahextoi(&s[2]);
|
||||
}else{
|
||||
return str_ainttoi(s);
|
||||
|
@@ -12,6 +12,7 @@ extern "C" {
|
||||
const char *str_find_char_right(const char *s, char c);
|
||||
const char *str_find_char_right_p(const char *s,const char *const p, char c);
|
||||
const char *str_find_char_left(const char *const p,const char *s, char c);
|
||||
int str_ahextoi(const char *s);
|
||||
int str_atoi(const char *s);
|
||||
int str_len(const char *s);
|
||||
int str_cpystr(char *s1, const char *s2, char c);
|
||||
|
Reference in New Issue
Block a user