<?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 zusammensetzen]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich möchte einen String aus einem anderen String und einer Zahl zusammensetzen. Leider funktioniert folgende (für mich intuitive) Zuweisung nicht:</p>
<pre><code class="language-cpp">counter = 1;
CString pl = &quot;PlanePlane&quot;+counter;
</code></pre>
<p>Das liefert leider<br />
pl = &quot;lanePlane&quot;</p>
<p>Was ist falsch, wie mache ich es richtig?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/159343/string-zusammensetzen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 10 Sep 2026 13:03:47 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/159343.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 14 Sep 2006 08:45:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String zusammensetzen on Thu, 14 Sep 2006 08:45:22 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich möchte einen String aus einem anderen String und einer Zahl zusammensetzen. Leider funktioniert folgende (für mich intuitive) Zuweisung nicht:</p>
<pre><code class="language-cpp">counter = 1;
CString pl = &quot;PlanePlane&quot;+counter;
</code></pre>
<p>Das liefert leider<br />
pl = &quot;lanePlane&quot;</p>
<p>Was ist falsch, wie mache ich es richtig?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1137080</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1137080</guid><dc:creator><![CDATA[raterchen]]></dc:creator><pubDate>Thu, 14 Sep 2006 08:45:22 GMT</pubDate></item><item><title><![CDATA[Reply to String zusammensetzen on Thu, 14 Sep 2006 08:52:06 GMT]]></title><description><![CDATA[<p>C++ hat keine automatische Umwandlung von Zahlen in Strings. Im Gegenteil - String-Literale gelten als char-Pointer und deine Addition wird in Pointer-Arithmetik umgewandelt.</p>
<p>Also kannst du entweder die Standard-Variante verwenden, den String über Stringstreams zusammenzusetzen - oder (da du CString erwähnt hast) du nutzt Format():</p>
<pre><code class="language-cpp">//Variante a:
stringstream conv;
conv&lt;&lt;&quot;PlaneLane&quot;&lt;&lt;counter;
string pl = conv.str();

//Variante b:
CString pl;
pl.Format(&quot;PlaneLane%i&quot;,counter);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1137086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1137086</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 14 Sep 2006 08:52:06 GMT</pubDate></item><item><title><![CDATA[Reply to String zusammensetzen on Thu, 14 Sep 2006 09:03:21 GMT]]></title><description><![CDATA[<p>Moin!</p>
<p>Muss ich bei Variante 1 noch etwas includieren? Er kennt stringstream nicht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1137095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1137095</guid><dc:creator><![CDATA[raterchen]]></dc:creator><pubDate>Thu, 14 Sep 2006 09:03:21 GMT</pubDate></item><item><title><![CDATA[Reply to String zusammensetzen on Thu, 14 Sep 2006 09:10:17 GMT]]></title><description><![CDATA[<p>raterchen schrieb:</p>
<blockquote>
<p>Moin!</p>
<p>Muss ich bei Variante 1 noch etwas includieren? Er kennt stringstream nicht...</p>
</blockquote>
<p>#include &lt;sstream&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1137101</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1137101</guid><dc:creator><![CDATA[GPC]]></dc:creator><pubDate>Thu, 14 Sep 2006 09:10:17 GMT</pubDate></item></channel></rss>