Notas sobre o uso de QString

QString::IsNull() e QString::IsEmpty()

	QString str; // str is null, and is empty
	
	str = ""; // str is empty, is not null (存有一个字符串末尾的0,至少占一个字节)

QString::toInt()

	QString strNum = QString::number(1.44);
	int num = strNum.toInt();
	// 结果 num == 0  !!!

QString::size()

	计算字符串的尺寸,可能每次调用都会遍历一下字符串,来统计长度!

QString::toLatin1()

	QString str = "abc";
	str.[0].toLatin1();
	QString 内部吧字符串按照 QChar 的格式存储,toLatin1(); 是将这个 QChar 转成 char 
	即 ASCⅡ 码的字节

Acho que você gosta

Origin blog.csdn.net/CXYYL/article/details/119178339
Recomendado
Clasificación