Qt的QString类提供了很方便的对字符串操作的接口。
- 使某个字符填满字符串,也就是说字符串里的所有字符都有等长度的ch来代替。
QString::fill ( QChar ch, int size = -1 )
例:
QString str = "Berlin"; str.fill('z'); // str == "zzzzzz" str.fill('A', 2); // str == "AA"
2,从字符串里查找相同的某个字符串str。
int QString::indexOf ( const QString & str, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive ) const
例如: