Qt532.QString::split()

2062 단어
1、효과가 JS와 같은 것 같다
1.1 QString 인코딩 변환(https://www.cnblogs.com/CodeSkill/p/5082447.html)
2. 코드:
void MainWindow::on_pushButton_2_clicked()
{
    QString str = "A B 10 2";
    QStringList strs = str.split(" ");
    for (int i=0; i)
        qDebug() << strs.at(i);
    qDebug() << "";


    str = "3   g  8    kjh 0";
    strs = str.split(" ");
    for (int i=0; i)
        qDebug() << strs.at(i);
    qDebug() << "";
}

2.1 콘솔 출력
Starting E:\ZZ_Qt5\Qt532_vs2010\build-Test2-Desktop_Qt_5_3_MSVC2010_OpenGL_32bit-Release\release\Test2.exe...
"A"
"B"
"10"
"2"

"3"
""
""
"g"
""
"8"
""
""
""
"kjh"
"0"

 
3、
4、
5、
 
전재 대상:https://www.cnblogs.com/cppskill/p/9599212.html

좋은 웹페이지 즐겨찾기