<?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 nach zahl]]></title><description><![CDATA[<p>Suche eine einfache und schnelle Methode etwas inder art umzuwandeln:</p>
<p>String s=&quot;1 0 0 1 2 2 -2 8 -4&quot;</p>
<p>daraus möchte ich die durch jeweils ein leerezeichen getrennten werte auslesen und speichern.</p>
<p>Ich bin sicher dass es da schon etwas geben muss...</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/264686/string-nach-zahl</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Sep 2026 14:30:16 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/264686.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 11 Apr 2010 09:31:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 09:31:30 GMT]]></title><description><![CDATA[<p>Suche eine einfache und schnelle Methode etwas inder art umzuwandeln:</p>
<p>String s=&quot;1 0 0 1 2 2 -2 8 -4&quot;</p>
<p>daraus möchte ich die durch jeweils ein leerezeichen getrennten werte auslesen und speichern.</p>
<p>Ich bin sicher dass es da schon etwas geben muss...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880902</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880902</guid><dc:creator><![CDATA[shisha]]></dc:creator><pubDate>Sun, 11 Apr 2010 09:31:30 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 09:36:53 GMT]]></title><description><![CDATA[<p>Das nennt sich stringstream.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880908</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Sun, 11 Apr 2010 09:36:53 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 09:45:16 GMT]]></title><description><![CDATA[<p>Ich habe das ganze auch schonmal benötigt, such mal nach stringstream in der c++ Referenz, findest du wunderschöne Beispiele.<br />
Ist ganz leicht;-).</p>
<p>Jedoch müsstest du zuerst einmal deinen string in einzelne strings parsen, mit jeweils einer Zahl, sollte aber kein Problem sein.</p>
<p>EDIT:<br />
Naja wieder mal zu lahm, aber ich hab hier mal n kleines Beispiel für dich;-)</p>
<pre><code class="language-cpp">#include &lt;sstream&gt;

string zahl = &quot;80&quot;;
stringstream wert( zahl );
int value;
wert &gt;&gt; value;
</code></pre>
<p>Hoffe konnte dir helfen.</p>
<p>Gruß freeG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880913</guid><dc:creator><![CDATA[fr33g]]></dc:creator><pubDate>Sun, 11 Apr 2010 09:45:16 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 09:41:28 GMT]]></title><description><![CDATA[<p>fr33g schrieb:</p>
<blockquote>
<p>Jedoch müsstest du zuerst einmal deinen string in einzelne strings parsen, mit jeweils einer Zahl, sollte aber kein Problem sein.</p>
</blockquote>
<p>Wozu? Stringstream kann mit beliebig vielen Zahlen umgehen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880917</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880917</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 11 Apr 2010 09:41:28 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 09:45:24 GMT]]></title><description><![CDATA[<p>stringstreams sind mir geläufig,</p>
<p>aber wie daraus die einzelnen zahlen rausfiltern?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880923</guid><dc:creator><![CDATA[shisha]]></dc:creator><pubDate>Sun, 11 Apr 2010 09:45:24 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 09:46:04 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>fr33g schrieb:</p>
<blockquote>
<p>Jedoch müsstest du zuerst einmal deinen string in einzelne strings parsen, mit jeweils einer Zahl, sollte aber kein Problem sein.</p>
</blockquote>
<p>Wozu? Stringstream kann mit beliebig vielen Zahlen umgehen.</p>
</blockquote>
<p>Oh, ok tut mir leid, das wusste ich leider nicht;-)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880924</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880924</guid><dc:creator><![CDATA[fr33g]]></dc:creator><pubDate>Sun, 11 Apr 2010 09:46:04 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 09:49:26 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;

using namespace std;

int main()
{
  string foo = &quot;1 2 3 4 5 6 7&quot;;
  stringstream ss(foo);
  int n;
  vector&lt;int&gt; v;

  while (ss &gt;&gt; n)
    v.push_back(n);

  cout &lt;&lt; v;
}
</code></pre>
<p>Ausgabe:</p>
<pre><code>[1, 2, 3, 4, 5, 6, 7]
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1880925</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880925</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Sun, 11 Apr 2010 09:49:26 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 09:59:03 GMT]]></title><description><![CDATA[<p>Okidoki, dann weiß ich dass ja jetzt aus;-)</p>
<p>Gruß freeG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880932</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880932</guid><dc:creator><![CDATA[fr33g]]></dc:creator><pubDate>Sun, 11 Apr 2010 09:59:03 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 10:01:48 GMT]]></title><description><![CDATA[<p>Janjan schrieb:</p>
<blockquote>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;

using namespace std;

int main()
{
  string foo = &quot;1 2 3 4 5 6 7&quot;;
  stringstream ss(foo);
  int n;
  vector&lt;int&gt; v;

  while (ss &gt;&gt; n)
    v.push_back(n);
  
  cout &lt;&lt; v;
}
</code></pre>
<p>Ausgabe:</p>
<pre><code>[1, 2, 3, 4, 5, 6, 7]
</code></pre>
</blockquote>
<p>Warum so umständlich mit vector?</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;

using namespace std;

int main()
{
  string foo = &quot;1 2 3 4 5 6 7&quot;;
  istringstream is(foo);
  int n;
  while (is &gt;&gt; n)
    cout &lt;&lt; n &lt;&lt; ' ';
 cout &lt;&lt; endl;
}
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880935</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880935</guid><dc:creator><![CDATA[otto8]]></dc:creator><pubDate>Sun, 11 Apr 2010 10:01:48 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 10:05:37 GMT]]></title><description><![CDATA[<blockquote>
<pre><code class="language-cpp">vector&lt;int&gt; v;

// ...

cout &lt;&lt; v;
</code></pre>
</blockquote>
<p>Irgendwas passiert hier, das ich nicht verstehe. Kann mich da mal jemand aufklären?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880938</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880938</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 11 Apr 2010 10:05:37 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 10:19:45 GMT]]></title><description><![CDATA[<p>Mein Beispielprogram parset die Zahlen aus dem String und fügt diese Zahl für Zahl zum vector hinzu. Der Vector wird am Ende über cout ausgegeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880945</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Sun, 11 Apr 2010 10:19:45 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 10:26:24 GMT]]></title><description><![CDATA[<p>Janjan schrieb:</p>
<blockquote>
<p>Mein Beispielprogram parset die Zahlen aus dem String und fügt diese Zahl für Zahl zum vector hinzu. Der Vector wird am Ende über cout ausgegeben.</p>
</blockquote>
<p>Überprüfe Dein Programm! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/26a0.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--warning"
      title=":warning:"
      alt="⚠"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880952</guid><dc:creator><![CDATA[otto8]]></dc:creator><pubDate>Sun, 11 Apr 2010 10:26:24 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 10:28:55 GMT]]></title><description><![CDATA[<p>Janjan schrieb:</p>
<blockquote>
<p>Mein Beispielprogram parset die Zahlen aus dem String und fügt diese Zahl für Zahl zum vector hinzu. Der Vector wird am Ende über cout ausgegeben.</p>
</blockquote>
<p>Ich verstehe schon, was du meinst. Ich frage mich aber, in welcher STL-Implementierung es einen <code>ostream::operator&lt;&lt;(vector&lt;int&gt;)</code> gibt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880955</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880955</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Sun, 11 Apr 2010 10:28:55 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 10:31:08 GMT]]></title><description><![CDATA[<p>Gibt es nicht, das ist eine Erweiterung von <a href="http://codepad.org" rel="nofollow">codepad.org</a>. Aber das sollte jedem klar sein, wie man sowas kurzerhand selbst implementieren kann.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880957</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880957</guid><dc:creator><![CDATA[Janjan]]></dc:creator><pubDate>Sun, 11 Apr 2010 10:31:08 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 11:33:13 GMT]]></title><description><![CDATA[<p>Gut dass ich das gelesen habe. Ich habe das gerade auf codepad getestet und hielt es schon fast für Standard. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1880988</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1880988</guid><dc:creator><![CDATA[Ad aCTa]]></dc:creator><pubDate>Sun, 11 Apr 2010 11:33:13 GMT</pubDate></item><item><title><![CDATA[Reply to string nach zahl on Sun, 11 Apr 2010 14:03:13 GMT]]></title><description><![CDATA[<p>Darf ich hier mal auf die <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39488.html" rel="nofollow">FAQ</a> hinweisen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1881068</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1881068</guid><dc:creator><![CDATA[freaky]]></dc:creator><pubDate>Sun, 11 Apr 2010 14:03:13 GMT</pubDate></item></channel></rss>