QT 的字符串的 使用的总结。
1.字符串截取函数的使用
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"
str = csv.section(',', -3, -2); // str == "middlename,surname"
str = path.section('/', -1); // str == "myapp