<?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 teilen?]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie teile ich einen String folgendermaßen:</p>
<p>Ich habe einen String s=abcdefghijklmnop<br />
danach möchte ich haben:</p>
<p>s so teilen, dass es nur 4-er Stücke sind und jedes 4-er Stück in eigene Variable:</p>
<p>s1=abcd<br />
s2=efgh<br />
s3=ijkl<br />
s4=mnop</p>
<p>Wie mache ich das?</p>
<p>Ach ja: Ich muss außerdem vorher rausbekommen, an welcher Stelle die Abschlussnull ist!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/173791/string-teilen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 10:23:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173791.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Feb 2007 21:59:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String teilen? on Mon, 19 Feb 2007 22:01:47 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie teile ich einen String folgendermaßen:</p>
<p>Ich habe einen String s=abcdefghijklmnop<br />
danach möchte ich haben:</p>
<p>s so teilen, dass es nur 4-er Stücke sind und jedes 4-er Stück in eigene Variable:</p>
<p>s1=abcd<br />
s2=efgh<br />
s3=ijkl<br />
s4=mnop</p>
<p>Wie mache ich das?</p>
<p>Ach ja: Ich muss außerdem vorher rausbekommen, an welcher Stelle die Abschlussnull ist!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231561</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231561</guid><dc:creator><![CDATA[tsp]]></dc:creator><pubDate>Mon, 19 Feb 2007 22:01:47 GMT</pubDate></item><item><title><![CDATA[Reply to String teilen? on Tue, 20 Feb 2007 06:53:14 GMT]]></title><description><![CDATA[<p>Moin,</p>
<p>z.B. mit der Funktion</p>
<p>basic_string substr(size_type pos = 0, size_type n = npos) const;</p>
<p>z.B.<br />
std::string s = &quot;abcdefghij&quot;;<br />
std::string s1 = s.substr(0, 4);<br />
std::cout &lt;&lt; s1 &lt;&lt; std::endl;</p>
<p>Wenn Du die Position erst finden musst, dann mit Stringfunktionen z.B.<br />
find_first_of nach der entsprechenden Stelle suchen.<br />
Vorher vielleicht noch die Länge mit s.length() ermitteln.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231626</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231626</guid><dc:creator><![CDATA[schokomann]]></dc:creator><pubDate>Tue, 20 Feb 2007 06:53:14 GMT</pubDate></item><item><title><![CDATA[Reply to String teilen? on Tue, 20 Feb 2007 10:14:19 GMT]]></title><description><![CDATA[<p>Vielen Dank und neue Frage:</p>
<p>Wie kann ich ein char in ein String umwandeln, um deine Lösung anzuwenden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231762</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231762</guid><dc:creator><![CDATA[tsp]]></dc:creator><pubDate>Tue, 20 Feb 2007 10:14:19 GMT</pubDate></item><item><title><![CDATA[Reply to String teilen? on Tue, 20 Feb 2007 10:22:36 GMT]]></title><description><![CDATA[<p>Du kannst ein char-Array einem string einfach zuweisen oder meinst du wirklich ein einzelnes char? Probier es doch einfach mal aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231770</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 20 Feb 2007 10:22:36 GMT</pubDate></item><item><title><![CDATA[Reply to String teilen? on Tue, 20 Feb 2007 10:35:01 GMT]]></title><description><![CDATA[<p>Hmm man kann nur nicht beim Initialisieren direkt einen char übergeben, sondern nur einen char-array. Mit = als zuweisungsoperator geht's allerdings.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231779</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231779</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Tue, 20 Feb 2007 10:35:01 GMT</pubDate></item><item><title><![CDATA[Reply to String teilen? on Tue, 20 Feb 2007 11:27:50 GMT]]></title><description><![CDATA[<p>Oder einfach per for-Schleife jedes Element des char-Arrays dem String zuweisen?!</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231826</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231826</guid><dc:creator><![CDATA[W0lf]]></dc:creator><pubDate>Tue, 20 Feb 2007 11:27:50 GMT</pubDate></item><item><title><![CDATA[Reply to String teilen? on Tue, 20 Feb 2007 11:35:53 GMT]]></title><description><![CDATA[<p>Warum so aufwendig - string hat noch ein paar weitere Ctoren. Z.B. kannst du per <code>string text(data,len);</code> einen String aus einem (nicht nullterminierten) char-Array oder per <code>string text(1,val);</code> aus einem Einzelzeichen erzeugen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231838</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231838</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Tue, 20 Feb 2007 11:35:53 GMT</pubDate></item></channel></rss>