适配3码互转算法

This commit is contained in:
ranchuan
2023-06-13 18:10:21 +08:00
parent 077c27f2bb
commit 2396796578
14 changed files with 2114 additions and 1250 deletions

View File

@@ -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);

View File

@@ -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);