<?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[Anfängerfrage zu strings]]></title><description><![CDATA[<p>hallo Community,<br />
ich hab ein Problem und weiß nicht welches. Warum bekomm ich bei diesem Programm keine Ausgabe?!?</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
#include&lt;string&gt;
using namespace std;

int main()
{
	string str_1;
	string str_2;	

	str_1 = &quot;hallo Chef&quot;;

	int i=0;
	while (str_1[i] != 'o') {
		str_2[i] = str_1[i];
		i++;
	}

	cout &lt;&lt; str_2;  //Diese Ausgabe kommt einfach nicht
	return 0;
}
</code></pre>
<p>ich will den Teil eines Strings in einen neuen string kopieren. Wenn ich char-arrays nehme gehts, aber ich will strings weil mir das die weitere verarbeitung leichter macht. Was muß ich verändern?</p>
<p>Danke im voraus<br />
Phil</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/130979/anfängerfrage-zu-strings</link><generator>RSS for Node</generator><lastBuildDate>Thu, 27 Aug 2026 03:56:07 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/130979.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 29 Dec 2005 16:52:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Anfängerfrage zu strings on Thu, 29 Dec 2005 16:52:27 GMT]]></title><description><![CDATA[<p>hallo Community,<br />
ich hab ein Problem und weiß nicht welches. Warum bekomm ich bei diesem Programm keine Ausgabe?!?</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
#include&lt;string&gt;
using namespace std;

int main()
{
	string str_1;
	string str_2;	

	str_1 = &quot;hallo Chef&quot;;

	int i=0;
	while (str_1[i] != 'o') {
		str_2[i] = str_1[i];
		i++;
	}

	cout &lt;&lt; str_2;  //Diese Ausgabe kommt einfach nicht
	return 0;
}
</code></pre>
<p>ich will den Teil eines Strings in einen neuen string kopieren. Wenn ich char-arrays nehme gehts, aber ich will strings weil mir das die weitere verarbeitung leichter macht. Was muß ich verändern?</p>
<p>Danke im voraus<br />
Phil</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952267</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952267</guid><dc:creator><![CDATA[Schnuffi88]]></dc:creator><pubDate>Thu, 29 Dec 2005 16:52:27 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zu strings on Thu, 29 Dec 2005 16:57:00 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include&lt;iostream&gt;
#include&lt;string&gt;
using namespace std;

int main()
{
	string str_1;
	string str_2;	

	str_1 = &quot;hallo Chef&quot;;

	int i=0;
	while (str_1[i] != 'o') {
		str_2 += str_1[i];
		i++;
	}

	cout &lt;&lt; str_2;  //Diese Ausgabe kommt einfach nicht
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/952268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952268</guid><dc:creator><![CDATA[..]]></dc:creator><pubDate>Thu, 29 Dec 2005 16:57:00 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zu strings on Thu, 29 Dec 2005 16:57:21 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Du must daran denken, das du bei str_2 auf Elemente zugreifst, die gar nicht vorhanden sind. Was glaubst du wohl, wieviele Elemente (also Chars) str_2 nach der Deklaration hat?</p>
<p>Und das Kopieren kannst du auch einfach so machen:</p>
<pre><code class="language-cpp">#include&lt;iostream&gt;
#include&lt;string&gt;
using namespace std;

int main()
{
    string str_1;
    string str_2;   

    str_1 = &quot;hallo Chef&quot;;

    str_2 = str_1; // Wert übergeben 
    cout &lt;&lt; str_2;  //Diese Ausgabe kommt einfach nicht
    return 0;
}
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952270</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952270</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Thu, 29 Dec 2005 16:57:21 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zu strings on Thu, 29 Dec 2005 17:07:04 GMT]]></title><description><![CDATA[<p>danke für die schnellen Antworten!</p>
<p>die erste Antwort klappt. So kann ich zumindest schonmal meinen Teilstring in einen neuen String kopieren.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7971">@akari</a><br />
Du hast mich falsch verstanden. Es geht mir nicht drum einen ganzen String zu kopieren. Das bekomm ich noch hin<br />
Ich will nur den Teil eines Strings in einen andern kopieren. Und am liebsten würde ich auch noch fest legen ab wo die Kopie eingefügt wird. z.B. string1: hallo Chef<br />
Wie schaff ich es jetzt ein anderes Wort (z.B. &quot;Meister&quot;) über das Wort Chef drüberzukopieren ohne das Wort &quot;hallo&quot; anzurühren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952276</guid><dc:creator><![CDATA[Schnuffi88]]></dc:creator><pubDate>Thu, 29 Dec 2005 17:07:04 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zu strings on Thu, 29 Dec 2005 17:10:24 GMT]]></title><description><![CDATA[<p>schau dir mal string::replace() und Konsorten in deiner bevorzugten C++-Referenz an.<br />
geloescht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952277</guid><dc:creator><![CDATA[geloescht]]></dc:creator><pubDate>Thu, 29 Dec 2005 17:10:24 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zu strings on Thu, 29 Dec 2005 17:11:51 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>schau dir mal die Methoden der <a href="http://www.cppreference.com/cppstring/" rel="nofollow">string-Klasse</a> an, insbesondere find() und substr().</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/952279</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/952279</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Thu, 29 Dec 2005 17:11:51 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zu strings on Tue, 03 Jan 2006 17:01:38 GMT]]></title><description><![CDATA[<p>Wie kann man einen string komplett in großbuchstaben umwandeln?</p>
<p>Also von &quot;Hallo Welt&quot; zu &quot;HALLO WELT&quot;.</p>
<p>Und wie komplett zu kleinbuchstaben. Gibt es da fertige Funktionen. In Delphi z.B: Uppercase(String);</p>
]]></description><link>https://www.c-plusplus.net/forum/post/955855</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/955855</guid><dc:creator><![CDATA[Anfänger06]]></dc:creator><pubDate>Tue, 03 Jan 2006 17:01:38 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zu strings on Tue, 03 Jan 2006 17:08:22 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Such im C++ Subforum nach <a href="http://www.cppreference.com/stdstring/toupper.html" rel="nofollow">toupper</a></p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/955859</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/955859</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 03 Jan 2006 17:08:22 GMT</pubDate></item><item><title><![CDATA[Reply to Anfängerfrage zu strings on Wed, 04 Jan 2006 10:08:08 GMT]]></title><description><![CDATA[<p>toupper (und tolower zur Umwandlung in Kleinbuchstaben) arbeiten auf einem einzelnen Zeichen - aber du kannst sie gerne per for()-Schleife oder std::transform auf jedes Zeichen deines Strings loslaufen lassen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/956371</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/956371</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Wed, 04 Jan 2006 10:08:08 GMT</pubDate></item></channel></rss>