casbin/ip_parser/parser/dtoi.cpp
std::pair<int, int> dtoi(std::string_view s) {
    int n = 0;
    int i = 0;
    std::pair<int, int> p;
    for(; i < s.length() && s[i] >= '0' && s[i] <= '9'; i++) {
        n = n*10 + int(s[i]-'0');
        if(n >= big) {
            p.first = big;
            p.second = i;
            return p;
        }
    }
    if(i == 0){
        p.first = 0;
        p.second = 0;
        return p;
    }
    p.first = n;
    p.second = i;
    return p;
}
// Decimal to integer.
// Returns number, characters consumed, success.
Decimal to integer.
Returns number, characters consumed, success.
Decimal to integer . Returns number characters consumed success .
std::pair<int, int> dtoi(std::string_view s) {
    int n = 0;
    int i = 0;
    std::pair<int, int> p;
    for(; i < s.length() && s[i] >= '0' && s[i] <= '9'; i++) {
        n = n*10 + int(s[i]-'0');
        if(n >= big) {
            p.first = big;
            p.second = i;
            return p;
        }
    }
    if(i == 0){
        p.first = 0;
        p.second = 0;
        return p;
    }
    p.first = n;
    p.second = i;
    return p;
}
std :: pair < int , int > dtoi ( std :: string_view s ) { int n = 0 ; int i = 0 ; std :: pair < int , int > p ; for ( ; i < s . length ( ) && s [ i ] >= ' ' && s [ i ] <= ' ' ; i ++ ) { n = n * 10 + int ( s [ i ] - ' ' ) ; if ( n >= big ) { p . first = big ; p . second = i ; return p ; } } if ( i == 0 ) { p . first = 0 ; p . second = 0 ; return p ; } p . first = n ; p . second = i ; return p ; }
Decimal to integer.
Decimal to integer .