<?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[int nach string]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>habe letztens eine Möglichkeit gesucht einen int Wert in einen std::string zu konvertieren. Habe hier im Forum nicht viel gefunden und google liefert auch viel Müll.</p>
<p>Schließlich fand ich das hier (Quelle: <a href="http://cpp.enisoc.com/faq/general/" rel="nofollow">http://cpp.enisoc.com/faq/general/</a> )</p>
<blockquote>
<p>Q. How do I convert from int to string?</p>
<p>A. Converting from int to string is a little more complicated than converting a string to int. There are no standard C++ functions for this, but there is a way to do it using standard stringstreams. The class stringstream is declared in header sstream and is used like this:</p>
<pre><code class="language-cpp">std::stringstream ss;
std::string str;
ss &lt;&lt; 31337;
ss &gt;&gt; str;
</code></pre>
<p>The variable str now contains &quot;31337&quot;.</p>
</blockquote>
<p>Wollte ich nur mal anmerken und würde mich freuen, falls jemand noch was elegenateres findet.</p>
<p>TechM</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/209973/int-nach-string</link><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 04:33:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/209973.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 05 Apr 2008 13:50:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to int nach string on Sat, 05 Apr 2008 13:50:45 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>habe letztens eine Möglichkeit gesucht einen int Wert in einen std::string zu konvertieren. Habe hier im Forum nicht viel gefunden und google liefert auch viel Müll.</p>
<p>Schließlich fand ich das hier (Quelle: <a href="http://cpp.enisoc.com/faq/general/" rel="nofollow">http://cpp.enisoc.com/faq/general/</a> )</p>
<blockquote>
<p>Q. How do I convert from int to string?</p>
<p>A. Converting from int to string is a little more complicated than converting a string to int. There are no standard C++ functions for this, but there is a way to do it using standard stringstreams. The class stringstream is declared in header sstream and is used like this:</p>
<pre><code class="language-cpp">std::stringstream ss;
std::string str;
ss &lt;&lt; 31337;
ss &gt;&gt; str;
</code></pre>
<p>The variable str now contains &quot;31337&quot;.</p>
</blockquote>
<p>Wollte ich nur mal anmerken und würde mich freuen, falls jemand noch was elegenateres findet.</p>
<p>TechM</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486960</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486960</guid><dc:creator><![CDATA[TechM]]></dc:creator><pubDate>Sat, 05 Apr 2008 13:50:45 GMT</pubDate></item><item><title><![CDATA[Reply to int nach string on Sat, 05 Apr 2008 13:51:50 GMT]]></title><description><![CDATA[<p>In der FAQ des C++ Forums hättest du genau die selbe Lösung gefunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486962</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486962</guid><dc:creator><![CDATA[-.-]]></dc:creator><pubDate>Sat, 05 Apr 2008 13:51:50 GMT</pubDate></item><item><title><![CDATA[Reply to int nach string on Sat, 05 Apr 2008 14:22:08 GMT]]></title><description><![CDATA[<p>Eleganter wird's nur mit boost::lexical_cast&lt;&gt; was im prinzip genau das selbe macht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486981</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486981</guid><dc:creator><![CDATA[darthdespotism]]></dc:creator><pubDate>Sat, 05 Apr 2008 14:22:08 GMT</pubDate></item><item><title><![CDATA[Reply to int nach string on Sat, 05 Apr 2008 14:22:48 GMT]]></title><description><![CDATA[<p>Was gefällt dir an der Lösung nicht?</p>
<p>Es gibt auch noch lexical_cast aus der boost-Bibliothek.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486982</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Sat, 05 Apr 2008 14:22:48 GMT</pubDate></item><item><title><![CDATA[Reply to int nach string on Sat, 05 Apr 2008 14:24:19 GMT]]></title><description><![CDATA[<p>boost::lexical_cast</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1486984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1486984</guid><dc:creator><![CDATA[elleganter]]></dc:creator><pubDate>Sat, 05 Apr 2008 14:24:19 GMT</pubDate></item><item><title><![CDATA[Reply to int nach string on Sun, 06 Apr 2008 16:55:56 GMT]]></title><description><![CDATA[<p>Also etwas eleganter finde ich doch den ostringstrem:</p>
<pre><code class="language-cpp">std::ostringstream ss;
ss &lt;&lt; 31337; // string steht jetzt in ss.str()
</code></pre>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1487485</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1487485</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Sun, 06 Apr 2008 16:55:56 GMT</pubDate></item></channel></rss>