diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-04-09 16:27:12 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-05-14 14:19:47 +0200 |
commit | b2ee684a13d01363c121d3ba597feaf274786fdb (patch) | |
tree | 61fa7ee93b6778a0edfb309896bdee3b3173044c /src/corelib/doc/snippets | |
parent | 7370b60cfe11da4d6167b51d83d18d9514a370c5 (diff) |
Remove QRegExp support from QString and StringList
Replacement methods do now exist in QRegExp, or
for QRegularExpression when porting to it.
Remove all autotests associated with the old methods.
Change-Id: I3ff1e0da4b53adb64d5a48a30aecd8b960f5e633
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/doc/snippets')
-rw-r--r-- | src/corelib/doc/snippets/qstring/main.cpp | 61 | ||||
-rw-r--r-- | src/corelib/doc/snippets/qstringlist/main.cpp | 14 |
2 files changed, 0 insertions, 75 deletions
diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index 271b6d7afc..39c4a8045b 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -350,11 +350,6 @@ void Widget::containsFunction() void Widget::countFunction() { - //! [18] - QString str = "banana and panama"; - str.count(QRegExp("a[nm]a")); // returns 4 - //! [18] - //! [95] QString str = "banana and panama"; str.count(QRegularExpression("a[nm]a")); // returns 4 @@ -425,11 +420,6 @@ void Widget::indexOfFunction() void Widget::firstIndexOfFunction() { - //! [25] - QString str = "the minimum"; - str.indexOf(QRegExp("m[aeiou]"), 0); // returns 4 - //! [25] - //! [93] QString str = "the minimum"; str.indexOf(QRegularExpression("m[aeiou]"), 0); // returns 4 @@ -480,11 +470,6 @@ void Widget::lastIndexOfFunction() x.lastIndexOf(y, 1); // returns -1 //! [29] - //! [30] - QString str = "the minimum"; - str.lastIndexOf(QRegExp("m[aeiou]")); // returns 8 - //! [30] - //! [94] QString str = "the minimum"; str.lastIndexOf(QRegularExpression("m[aeiou]")); // returns 8 @@ -559,12 +544,6 @@ void Widget::removeFunction() // t == "li Bb" //! [38] - //! [39] - QString r = "Telephone"; - r.remove(QRegExp("[aeiou].")); - // r == "The" - //! [39] - //! [96] QString r = "Telephone"; r.remove(QRegularExpression("[aeiou].")); @@ -587,18 +566,6 @@ void Widget::replaceFunction() // str == "color behavior flavor neighbor" //! [41] - //! [42] - QString s = "Banana"; - s.replace(QRegExp("a[mn]"), "ox"); - // s == "Boxoxa" - //! [42] - - //! [43] - QString t = "A <i>bon mot</i>."; - t.replace(QRegExp("<i>([^<]*)</i>"), "\\emph{\\1}"); - // t == "A \\emph{bon mot}." - //! [43] - //! [86] QString equis = "xxxxxx"; equis.replace("xx", "x"); @@ -707,13 +674,6 @@ void Widget::sectionFunction() str = data.section("**", -3, -2); // str == "middlename**surname" //! [54] - //! [55] - QString line = "forename\tmiddlename surname \t \t phone"; - QRegExp sep("\\s+"); - str = line.section(sep, 2, 2); // str == "surname" - str = line.section(sep, -3, -2); // str == "middlename surname" - //! [55] - //! [89] QString line = "forename\tmiddlename surname \t \t phone"; QRegularExpression sep("\\s+"); @@ -751,27 +711,6 @@ void Widget::sizeFunction() void Widget::splitFunction() { - //! [59] - QString str; - QStringList list; - - str = "Some text\n\twith strange whitespace."; - list = str.split(QRegExp("\\s+")); - // list: [ "Some", "text", "with", "strange", "whitespace." ] - //! [59] - - //! [60] - str = "This time, a normal English sentence."; - list = str.split(QRegExp("\\W+"), Qt::SkipEmptyParts); - // list: [ "This", "time", "a", "normal", "English", "sentence" ] - //! [60] - - //! [61] - str = "Now: this sentence fragment."; - list = str.split(QRegExp("\\b")); - // list: [ "", "Now", ": ", "this", " ", "sentence", " ", "fragment", "." ] - //! [61] - //! [90] QString str; QStringList list; diff --git a/src/corelib/doc/snippets/qstringlist/main.cpp b/src/corelib/doc/snippets/qstringlist/main.cpp index 80788ccd76..5284a5fb78 100644 --- a/src/corelib/doc/snippets/qstringlist/main.cpp +++ b/src/corelib/doc/snippets/qstringlist/main.cpp @@ -145,20 +145,6 @@ Widget::Widget(QWidget *parent) //! [13] list.clear(); -//! [14] - list << "alpha" << "beta" << "gamma" << "epsilon"; - list.replaceInStrings(QRegExp("^a"), "o"); - // list == ["olpha", "beta", "gamma", "epsilon"] -//! [14] - - list.clear(); -//! [15] - list << "Bill Clinton" << "Murray, Bill"; - list.replaceInStrings(QRegExp("^(.*), (.*)$"), "\\2 \\1"); - // list == ["Bill Clinton", "Bill Murray"] -//! [15] - - list.clear(); //! [16] list << "alpha" << "beta" << "gamma" << "epsilon"; list.replaceInStrings(QRegularExpression("^a"), "o"); |