mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-06 07:32:51 +02:00
17 lines
240 B
C++
17 lines
240 B
C++
#include <cctype>
|
|
#include "str2int.h"
|
|
|
|
int str2int(const char *str, int len)
|
|
{
|
|
int res = 0;
|
|
|
|
for (const char *sp = str; sp < str + len; sp++) {
|
|
if (::isdigit(*sp))
|
|
res = res * 10 + *sp - '0';
|
|
else
|
|
return -1;
|
|
}
|
|
|
|
return res;
|
|
}
|