QString str1 = "Welcome ";
str1=str1+"to you! "; //str1=" Welcome to you! "
QString str2="Hello, ";
str2+="World! "; //str2="Hello,World! "
QString str1 = "Welcome ";
QString str2 = "to ";
str1.append(str2); //str1=" Welcome to"
str1.append("you! "); //str1="Welcome to you! "
QString str;
str.sprintf("%s"," Welcome "); //str="Welcome "
str.sprintf("%s"," to you! "); //str="to you! "
str.sprintf("%s %s"," Welcome ", "to you! "); //str=" Welcome to you! "
operator<(const QString&):比较一个字符串是否小于另一个字符串,如果是,则返回true。
operator<=(const QString&):比较一个字符串是否小于等于另一个字符串,如果是,则返回true。
operator==(const QString&):比较两个字符串是否相等,如果相等,则返回true。
operator>=(const QString&):比较一个字符串是否大于等于另一个字符串,如果是,则返回true。
QString str="125";
bool ok;
int hex=str.toInt(&ok,16); //ok=true,hex=293
int dec=str.toInt(&ok,10); //ok=true,dec=125