@jmarshallnz 
I'll implement this in your way, but with small change: while .c_str() is guaranteed to be null-terminated, operator[] at pos == length has undefined behavior. So I'll convert string to C-string at first. And processing C-array is **much** faster that using std::string::operator[].