/*-----------------------------------------------------------------------------------------------------------------------*/
| //QString -> C++的string -> char * |
| QString str = "123"; char *p = str.toStdString().data(); |
| |
| //QString -> QByteArray |
| QString str = "123"; QByteArray b = str.toUtf8(); //有中文的时候 |
| QByteArray c = str.toLocal8Bit(); //转化为本地编码(例:Window) |
| //QByteArray -> char * |
| char *p = b.data(); |
| //char * -> QString |
| QString d = QString(p); |
/*------------------------------------------------------------------------------------------------------------------------*/
QT里的编码格式是utf8
QT字符串转化网络编程时用到
最新推荐文章于 2023-02-07 20:17:13 发布