在 QRegExp 类中写到:
QRegExp rx( "^\\S+$" ); // match strings without whitespace就是与没有空格的匹配吧。
在QString类中提到:
QString line( "forename\tmiddlename surname \t \t phone" );
QRegExp sep( "\s+" );
QString s = line.section( sep, 2, 2 ); // s == "surname"我能理解
如果start或者end为负数,我们就从字符串的右面开始计数,最右面的是-1,接着是-2,依此类推。
QString line( "forename\tmiddlename surname \t \t phone" );
QRegExp sep( "\\s+" );
QString s = line.section( sep, -3, -2 ); // s == "middlename surname"我不太明白?
[ 此贴被XChinux在2006-04-20 16:26重新编辑 ]