<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[String Iteratoren]]></title><description><![CDATA[<p>Guten Abend allerseits,</p>
<p>habe wieder mal ein Problem. Ich will, dass im String xxx mehrere Überprüfungen stattfinden. Beispiel:</p>
<pre><code>string::iterator i;
   for(i=mRNA.begin();i!=mRNA.end();++i)
{
           if(*i = 'UUU' || 'UUC')
           *i='Phe';
           ++i;
           if(*i = 'UGU' || 'UGC')
           *i='Cys';
           ++i;
}
</code></pre>
<p>usw. Da sollen noch 5 weitere Überprüfungen kommen. Mir ist schon klar dass das da oben nicht richtig ist, aber wollte nachfragen ob jemand vllt eine Lösung weiß.</p>
<p>Danke, König Engluish</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/171477/string-iteratoren</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 11:55:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/171477.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 25 Jan 2007 17:50:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 17:50:40 GMT]]></title><description><![CDATA[<p>Guten Abend allerseits,</p>
<p>habe wieder mal ein Problem. Ich will, dass im String xxx mehrere Überprüfungen stattfinden. Beispiel:</p>
<pre><code>string::iterator i;
   for(i=mRNA.begin();i!=mRNA.end();++i)
{
           if(*i = 'UUU' || 'UUC')
           *i='Phe';
           ++i;
           if(*i = 'UGU' || 'UGC')
           *i='Cys';
           ++i;
}
</code></pre>
<p>usw. Da sollen noch 5 weitere Überprüfungen kommen. Mir ist schon klar dass das da oben nicht richtig ist, aber wollte nachfragen ob jemand vllt eine Lösung weiß.</p>
<p>Danke, König Engluish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217080</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217080</guid><dc:creator><![CDATA[König Engluish]]></dc:creator><pubDate>Thu, 25 Jan 2007 17:50:40 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 18:31:26 GMT]]></title><description><![CDATA[<p>Zwei Dinge: '=' ist eine Zuweisung, Du willst wohl eher '==', also Vergleich auf Gleichheit.</p>
<p>Zum anderen: Ein Iterator repräsentiert *ein* Element i String, also ein 'char'. Deine Elemente sind Strings. Du brauchst dementsprechend (um gleich mal die Fachterminologie zu verwenden) ein sliding window.</p>
<p>Folgender Code ist nicht besonders effizient (es finden Kopier-Operationen statt), sollte aber so klappen:</p>
<pre><code class="language-cpp">stringstream peptide;
for(string::iterator i = mRNA.begin(); i != mRNA.end(); i += 3) {
    string window(i, i + 3);
    if (window == &quot;UUU&quot; or window == &quot;UUC&quot;)
        peptide &lt;&lt; &quot;Phe&quot;; // oder, IMHO besser: peptide &lt;&lt; 'F' ...
    // ... etc.
}
</code></pre>
<p>Dazu sei aber gesagt, dass ich hier eher eine map&lt;string, string&gt; verwenden würde, da Du ja wahrscheinlich die gesamte AA-Tabelle durchgehen willst.</p>
<p>/EDIT: Schrittweite der Schleife korrigiert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217090</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217090</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Thu, 25 Jan 2007 18:31:26 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 18:34:47 GMT]]></title><description><![CDATA[<p>Also habs jetzt so umgeschrieben:</p>
<pre><code>stringstream sa; 
for(string::iterator i = mRNA.begin(); i != mRNA.end(); ++i) { 
    string window(i, i + 3); 
    if (window == &quot;UUU&quot; || window == &quot;UUC&quot;) 
        sa &lt;&lt; &quot;Phe&quot;; 
}
cout&lt;&lt;sa;
</code></pre>
<p>Es müsste ja eigentlich gehen, jedoch wird mir am Schluss nichts angezeigt?<br />
P.S. Es muss noch &lt;sstream&gt; eingefügt werden</p>
<p>König Engluish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217100</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217100</guid><dc:creator><![CDATA[König Engluish]]></dc:creator><pubDate>Thu, 25 Jan 2007 18:34:47 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 18:38:10 GMT]]></title><description><![CDATA[<p>König Engluish schrieb:</p>
<blockquote>
<p>Es müsste ja eigentlich gehen, jedoch wird mir am Schluss nichts angezeigt?</p>
</blockquote>
<p>versuch mal &quot;cout &lt;&lt; sa.str();&quot;.</p>
<p>Übrigens kann man sich die Kopie sparen, wenn man das Fenster nicht explizit erstellt und zum Vergleich die Funktio 'std::equal' aus &lt;algorithm&gt; verwendet:</p>
<pre><code class="language-cpp">stringstream sa;
for(string::iterator i = mRNA.begin(); i != mRNA.end(); i += 3) {
    if (equal(i, i + 3, &quot;UUU&quot;) || equal(i, i + 3, &quot;UUC&quot;))
        sa &lt;&lt; &quot;Phe&quot;;
}
cout &lt;&lt; sa.str();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1217102</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217102</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Thu, 25 Jan 2007 18:38:10 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 18:43:30 GMT]]></title><description><![CDATA[<p>Es will einfach nicht bei mir funktionieren..</p>
<p>Gäbe es denn evt. noch weitere Möglichkeiten?</p>
<p>König Engluish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217105</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217105</guid><dc:creator><![CDATA[König Engluish]]></dc:creator><pubDate>Thu, 25 Jan 2007 18:43:30 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 18:48:49 GMT]]></title><description><![CDATA[<p>König Engluish schrieb:</p>
<blockquote>
<p>Es will einfach nicht bei mir funktionieren..</p>
</blockquote>
<p>Was funktioniert nicht? Welcher Fehler kommt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217107</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217107</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Thu, 25 Jan 2007 18:48:49 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 19:01:36 GMT]]></title><description><![CDATA[<p>Beim Compilieren geht alles, wenn ich es ausführe kommt... NICHTS einfach gar nichts..</p>
<p>König Engluish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217111</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217111</guid><dc:creator><![CDATA[König Engluish]]></dc:creator><pubDate>Thu, 25 Jan 2007 19:01:36 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 19:06:31 GMT]]></title><description><![CDATA[<p>König Engluish schrieb:</p>
<blockquote>
<p>Beim Compilieren geht alles, wenn ich es ausführe kommt... NICHTS einfach gar nichts..</p>
</blockquote>
<p>Ok, pack noch ein 'flush' hinter die Ausgabe, oder ein 'endl'.</p>
<p>Oder schließt sich die Konsole etwa? Da gibt's ne FAQ drüber, man kann das Schließen verhindern:</p>
<pre><code class="language-cpp">void wait() // Ungetestet, aus dem Gedächtnis.
{
    using std::cin;
    cin.clear();
    cin.ignore(cin.rdbuf()-&gt;in_avail());
    cin.get();
}
</code></pre>
<p>Diese Funktion dann halt nach der Ausgabe in 'main' aufrufen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217114</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217114</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Thu, 25 Jan 2007 19:06:31 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 19:09:01 GMT]]></title><description><![CDATA[<p>Das mit dem Schließen ist nicht das Problem, soo neu bin ich auch wieder nicht (; nein, dieses cout&lt;&lt;sa.str(); funktioniert einfach nicht, werd mal jetzt noch deinen code ausprobieren</p>
<p>König Engluish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217117</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217117</guid><dc:creator><![CDATA[König Engluish]]></dc:creator><pubDate>Thu, 25 Jan 2007 19:09:01 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 20:32:09 GMT]]></title><description><![CDATA[<p>Hatte jetzt noch eine andere Idee.</p>
<pre><code>int laenge=mRNA.length();

    char puffer[laenge];

    for(int i=0;i&lt;laenge/3;i=i+3)
    {
            mRNA.copy(puffer,i);

    }
</code></pre>
<p>Ich will, dass der Puffer nach und nach überprüft wird, nach den Kombinationen und dann die Lösungen an mRNA anhängt. Wäre das realisierbar ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217184</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217184</guid><dc:creator><![CDATA[König Engluish]]></dc:creator><pubDate>Thu, 25 Jan 2007 20:32:09 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Thu, 25 Jan 2007 20:43:41 GMT]]></title><description><![CDATA[<p>Zuerst mal: Was hat dieser neue Code mit der Fragestellung zu tun?</p>
<p>Zweitens: Wieso willst Du das Ergebnis an die RNS anhängen? Das scheint keinen Sinn zu ergeben.</p>
<p>Drittens: Iteratoren kann man hier leider nicht verwenden, da man den String ja verändert.</p>
<p>Viertens: So.</p>
<pre><code class="language-cpp">string::size_type len = mRNA.length();
for (string::size_type i = 0; i &lt; len; i += 3) {
    string::const_iterator it = mRNA.begin() + i;
    if (equal(it, it + 3, &quot;UUC&quot;) or equal(it, it + 3, &quot;UUU&quot;))
        mRNA += &quot;Phe&quot;;
    // usw. usf.
}
</code></pre>
<p>Aber wie gesagt: Was soll das bringen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217193</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217193</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Thu, 25 Jan 2007 20:43:41 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Fri, 26 Jan 2007 16:46:01 GMT]]></title><description><![CDATA[<blockquote>
<p>mRNA += &quot;Phe&quot;;</p>
</blockquote>
<p>lol? nicht aufgepasst in bio?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217677</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217677</guid><dc:creator><![CDATA[besserwisser]]></dc:creator><pubDate>Fri, 26 Jan 2007 16:46:01 GMT</pubDate></item><item><title><![CDATA[Reply to String Iteratoren on Fri, 26 Jan 2007 17:29:53 GMT]]></title><description><![CDATA[<p>besserwisser schrieb:</p>
<blockquote>
<blockquote>
<p>mRNA += &quot;Phe&quot;;</p>
</blockquote>
<p>lol? nicht aufgepasst in bio?</p>
</blockquote>
<p>Äh, lies Dir den ganzen Thread (oder auch nur das gesamte Posting, insbesondere den Satz &quot;<strong>Das scheint keinen Sinn zu ergeben.</strong>&quot;) durch, bevor Du klugscheißt. Mir ist der Unterschied zwischen Peptid- und Phosphodiesterbindung durchaus bewusst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1217700</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1217700</guid><dc:creator><![CDATA[Konrad Rudolph]]></dc:creator><pubDate>Fri, 26 Jan 2007 17:29:53 GMT</pubDate></item></channel></rss>