Reaching a specific word in a string

后端 未结 2 1914
醉酒成梦
醉酒成梦 2021-01-24 22:53

Hi I have a string like this:

word1--tab--word2--tab--word3--tab--word4--tab--word5--tab--word6

I need to extract the third word fr

2条回答
  •  日久生厌
    2021-01-24 23:07

    assuming "tab" is \t;

    std::istringstream str(".....");
    std::string temp, word;
    
    str >> temp >> temp >> word;
    

提交回复
热议问题