<?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[zahl aus string heraus&amp;quot;filtern&amp;quot;]]></title><description><![CDATA[<p>Hallo,<br />
ich hab jetzt z.B so was:<br />
string mem = &quot;MemTotal:57635kB&quot;<br />
jetzt will ich das ich dann eine variable habe wo die zahl(57635) drinne steht.<br />
Wenn ich sscanf benutze habe ich dann einen anderen wert (weicht etwas ab).<br />
Wie soll ich das am besten machen?<br />
Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/123779/zahl-aus-string-heraus-quot-filtern-quot</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 18:22:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/123779.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Oct 2005 20:04:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to zahl aus string heraus&amp;quot;filtern&amp;quot; on Wed, 19 Oct 2005 20:04:27 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich hab jetzt z.B so was:<br />
string mem = &quot;MemTotal:57635kB&quot;<br />
jetzt will ich das ich dann eine variable habe wo die zahl(57635) drinne steht.<br />
Wenn ich sscanf benutze habe ich dann einen anderen wert (weicht etwas ab).<br />
Wie soll ich das am besten machen?<br />
Vielen Dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896538</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896538</guid><dc:creator><![CDATA[zahlstring]]></dc:creator><pubDate>Wed, 19 Oct 2005 20:04:27 GMT</pubDate></item><item><title><![CDATA[Reply to zahl aus string heraus&amp;quot;filtern&amp;quot; on Wed, 19 Oct 2005 20:07:44 GMT]]></title><description><![CDATA[<p>Lösch erstmal alle Zeichen, die keine Ziffer sind. Wenn die Zahl negativ sein kann, führendes - aber nicht.</p>
<p>Bye, TGGC (<a href="http://tggc.tg.funpic.de/index.php?cat=4" rel="nofollow">Demo or Die</a>)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896541</guid><dc:creator><![CDATA[TGGC]]></dc:creator><pubDate>Wed, 19 Oct 2005 20:07:44 GMT</pubDate></item><item><title><![CDATA[Reply to zahl aus string heraus&amp;quot;filtern&amp;quot; on Thu, 20 Oct 2005 14:32:14 GMT]]></title><description><![CDATA[<p>versuch mal ein einfaches:</p>
<pre><code class="language-cpp">atoi();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/896877</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896877</guid><dc:creator><![CDATA[asr]]></dc:creator><pubDate>Thu, 20 Oct 2005 14:32:14 GMT</pubDate></item><item><title><![CDATA[Reply to zahl aus string heraus&amp;quot;filtern&amp;quot; on Fri, 21 Oct 2005 07:26:23 GMT]]></title><description><![CDATA[<p>asr schrieb:</p>
<blockquote>
<p>versuch mal ein einfaches:</p>
<pre><code class="language-cpp">atoi();
</code></pre>
</blockquote>
<p>Nachdem man den Anfang der &quot;Zahl&quot; kennt, ist das sicher die beste Wahl, aber auf den obigen String kann man es noch nicht direkt anwenden. Aber zum Glück kann man den sehr einfach finden:</p>
<pre><code class="language-cpp">//für Zahlen ohne Vorzeichen (benötigt &lt;algorithm&gt; und &lt;cctype&gt;):
start=std::find_if(mem.begin(),mem.end(),isdigit);

// für Zahlen mit Vorzeichen:
inline bool isnumsign(char c)
{ return isdigit(c)||c=='+'||c=='-'; }

start=std::find_if(mem.begin(),mem.end(),isnumsign);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/897380</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/897380</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Fri, 21 Oct 2005 07:26:23 GMT</pubDate></item></channel></rss>