1.arg()函数

  QString  test=QString("_haha_%1_hehe%2") .arg("ee").arg("aa");      //test="_haha_ee_heheaa"

  eg:arg(const QString &a, int fieldWidth = 0, QChar fillChar = QLatin1Char( ' ' )) const        参数1.连接的字符;参数2.字符所占据的宽度;参数3.如果字符的宽度小于参数2的宽度,则用参数3的字符填充。

  注意:fieldWidth >0 ,代表的右对齐;   fieldWidth <0,代表的左对齐。如下图所示:

  

.

2.section()函数

QString QString::section(QChar sep, int start, int end = -1, SectionFlags flags = SectionDefault) const

  QString str;

  QString csv = "forename,middlename,surname,phone";
  QString path = "/usr/local/bin/myapp"; // First field is empty
  QString::SectionFlag flag = QString::SectionSkipEmpty;
  str = csv.section(',', 2, 2);   // str == "surname"
  str = path.section('/', 3, 4);  // str == "bin/myapp"
  str = path.section('/', 3, 3, flag); // str == "myapp"