What is the best algorithm for arbitrary delimiter/escape character processing?

后端 未结 7 1843
心在旅途
心在旅途 2021-01-02 07:57

I\'m a little surprised that there isn\'t some information on this on the web, and I keep finding that the problem is a little stickier than I thought.

Here\'s the r

7条回答
  •  执笔经年
    2021-01-02 08:17

    void smartSplit(string const& text, char delim, char esc, vector& tokens)
    {
        enum State { NORMAL, IN_ESC };
        State state = NORMAL;
        string frag;
    
        for (size_t i = 0; i

提交回复
热议问题