понедельник, 16 августа 2010 г.

Аналог питоновского slice в QString

QString QString::mid ( int position, int n = -1 ) const

Returns a string that contains n characters of this string, starting at the specified position index.

Returns a null string if the position index exceeds the length of the string. If there are less than n characters available in the string starting at the given position, or if n is -1 (default), the function returns all characters that are available from the specified position.

Example:

QString x = "Nine pineapples";
QString y = x.mid(5, 4); // y == "pine"
QString z = x.mid(5); // z == "pineapples"

See also left() and right().

Комментариев нет:

Отправить комментарий