QSting, QChar, char等的转换

1,QChar 转换char: char QChar::toLatin1();char QChar::toAscii();

2,Char转QChar: QChar(char ch);

3,QString 转char*:

QString str; char *ch; QByteArray ba=str.toLatin1();ch = ba.data();

4,char *转QString:

char *c_str = "hellow";QString str=QString(QLatin1String(c_str));

5,QString 转QChar*:

QString str = "hellow"; QChar *char = new QChar[10]; char = str.data();

6,QChar 转QString: QString(QChar ch);

 

7,QString转数字:QString::toxxx.

8,数字转QString: QString::number(), setNum

 

转载于:https://www.cnblogs.com/yangjunhe460/p/10711663.html

你可能感兴趣的:(QSting, QChar, char等的转换)