Note that there are some explanatory texts on larger screens.

plurals
  1. PORead different QStrings with the same previous and the same following word? QString::indexOf
    primarykey
    data
    text
    <p>I read two QStrings (ValueOne,ValueTwo) out of a file with (just a basic example)</p> <pre><code>int main(int argc, char *argv[]) { QString x = ("yes " "start ValueOne end" "no" "start ValueTwo end"); //try to read ValueOne QString s = "start"; QString e = "end"; int start = x.indexOf(s, 0, Qt::CaseInsensitive); int end = x.indexOf(e, Qt::CaseInsensitive); if(start != -1){ QString y = x.mid(start + s.length(), (end - (start + s.length()))); qDebug() &lt;&lt; y &lt;&lt; (start + s.length()) &lt;&lt; (end - (start + s.length())); //try to read ValueTwo QString s2 = "start"; QString e2 = "end"; int start2 = x.indexOf(s2, 0, Qt::CaseInsensitive); int end2 = x.indexOf(e2, Qt::CaseInsensitive); if(start2 != -1){ QString y2 = x.mid(start2 + s.length2(), (end2 - (start2 + s.length2()))); qDebug() &lt;&lt; y2 &lt;&lt; (start2 + s.length2()) &lt;&lt; (end2 - (start2 + s.length2())); } } </code></pre> <p>As you see the source code can't difference between ValueOne and ValueTwo just by "start" and "end", because both QString::mid() methods (which proceed line by line as far as I know) have the same start position and the same length (see <a href="http://qt-project.org/doc/qt-4.8/qstring.html#mid" rel="nofollow">http://qt-project.org/doc/qt-4.8/qstring.html#mid</a> ). Therefore I thought if the whole string was one line like</p> <pre><code>QString x = "yes start ValueOne end no start ValueTwo end "; </code></pre> <p>I could difference between the two values with QString s = "yes start" and QString s2 = "no start". So would convert the multiline String into a one line String be a solution and how can I do this? or Is there another maybe better solution? greetings</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload