Untitled

 avatar
unknown
c_cpp
a year ago
683 B
11
Indexable
 std::string Utilities::extractToken(const std::string &str, size_t &next_pos, bool &more)
    {
        std::string token;
        size_t start = str.find(getDelimiter(), next_pos);

        if (start == next_pos)
        {
            more = false;
            throw "delimiter at next position";
        }
        else if (start != std::string::npos && start != next_pos)
        {
            more = true;
            token = str.substr(next_pos, start - next_pos);
            next_pos = start + 1;
        }
        else
        {
            more = false;
            token = str.substr(next_pos);
        }

        setFieldWidth(token.length());

        return token;
    }
Editor is loading...
Leave a Comment