This question already has answers here:
How do I iterate over the words of a string?
                                
                                    (76个答案)
                                
                        
                                5年前关闭。
            
                    
Duplicate of

C ++中是否有一个功能与C中的split函数相同?

我写了这段代码

std::string str[] =line.split(";");


但是无法识别拆分请求。

最佳答案

看来您需要qt解决方案:

#include <QStringList>
//...

QStringList L = line.split( ";" , QString::SkipEmptyParts );
//                                 ^^^^^^^^^^^^^^optional

关于c++ - 函数在C++中拆分? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24078423/

10-11 22:46
查看更多