src/corelib/tools/qstring.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
child 18 2f34d5167611
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
  1588 
  1588 
  1589   \sa insert(), replace()
  1589   \sa insert(), replace()
  1590 */
  1590 */
  1591 QString &QString::remove(int pos, int len)
  1591 QString &QString::remove(int pos, int len)
  1592 {
  1592 {
  1593     if (pos < 0)
  1593     if (pos < 0)  // count from end of string
  1594         pos += d->size;
  1594         pos += d->size;
  1595     if (pos < 0 || pos >= d->size) {
  1595     if (pos < 0 || pos >= d->size) {
  1596         // range problems
  1596         // range problems
  1597     } else if (pos + len >= d->size) {  // pos ok
  1597     } else if (len >= d->size - pos) {
  1598         resize(pos);
  1598         resize(pos); // truncate
  1599     } else if (len > 0) {
  1599     } else if (len > 0) {
  1600         detach();
  1600         detach();
  1601         memmove(d->data + pos, d->data + pos + len,
  1601         memmove(d->data + pos, d->data + pos + len,
  1602                 (d->size - pos - len + 1) * sizeof(ushort));
  1602                 (d->size - pos - len + 1) * sizeof(ushort));
  1603         d->size -= len;
  1603         d->size -= len;
  2679         return *this;
  2679         return *this;
  2680 
  2680 
  2681     realloc();
  2681     realloc();
  2682 
  2682 
  2683     int index = 0;
  2683     int index = 0;
  2684     int numCaptures = rx2.numCaptures();
  2684     int numCaptures = rx2.captureCount();
  2685     int al = after.length();
  2685     int al = after.length();
  2686     QRegExp::CaretMode caretMode = QRegExp::CaretAtZero;
  2686     QRegExp::CaretMode caretMode = QRegExp::CaretAtZero;
  2687 
  2687 
  2688     if (numCaptures > 0) {
  2688     if (numCaptures > 0) {
  2689         const QChar *uc = after.unicode();
  2689         const QChar *uc = after.unicode();
  7202    Returns true if string \a s1 is lexically greater than or equal to
  7202    Returns true if string \a s1 is lexically greater than or equal to
  7203    string \a s2; otherwise returns false.
  7203    string \a s2; otherwise returns false.
  7204 */
  7204 */
  7205 
  7205 
  7206 
  7206 
  7207 #ifndef QT_NO_DATASTREAM
  7207 #if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE))
  7208 /*!
  7208 /*!
  7209     \fn QDataStream &operator<<(QDataStream &stream, const QString &string)
  7209     \fn QDataStream &operator<<(QDataStream &stream, const QString &string)
  7210     \relates QString
  7210     \relates QString
  7211 
  7211 
  7212     Writes the given \a string to the specified \a stream.
  7212     Writes the given \a string to the specified \a stream.