<?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[text auf zeichen aufteilen]]></title><description><![CDATA[<p>hey<br />
ich hab einen text in einenm char array. wie kann ich den jetzt nach \n aufteilen ?</p>
<p>z.b. der text ist</p>
<pre><code class="language-cpp">char* str = &quot;123\n456\n789\n&quot;;
</code></pre>
<p>dan soll das aufgeteilte in ein neues array aufgeteil werden das in</p>
<pre><code class="language-cpp">char aufgeteil[3][3]
</code></pre>
<p>dann aufgeteilt[1] = &quot;123&quot; und aufgeteil[2] = &quot;456&quot; und aufgeteil[3] = &quot;789&quot; werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/285843/text-auf-zeichen-aufteilen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 21 Aug 2026 04:18:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/285843.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Apr 2011 17:03:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to text auf zeichen aufteilen on Thu, 28 Apr 2011 17:03:20 GMT]]></title><description><![CDATA[<p>hey<br />
ich hab einen text in einenm char array. wie kann ich den jetzt nach \n aufteilen ?</p>
<p>z.b. der text ist</p>
<pre><code class="language-cpp">char* str = &quot;123\n456\n789\n&quot;;
</code></pre>
<p>dan soll das aufgeteilte in ein neues array aufgeteil werden das in</p>
<pre><code class="language-cpp">char aufgeteil[3][3]
</code></pre>
<p>dann aufgeteilt[1] = &quot;123&quot; und aufgeteil[2] = &quot;456&quot; und aufgeteil[3] = &quot;789&quot; werden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2055680</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2055680</guid><dc:creator><![CDATA[a1932882]]></dc:creator><pubDate>Thu, 28 Apr 2011 17:03:20 GMT</pubDate></item><item><title><![CDATA[Reply to text auf zeichen aufteilen on Thu, 28 Apr 2011 17:11:23 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">std::vector&lt;std::string&gt; aufgeteilt;
boost::split(str, &quot;string to split&quot;, boost::is_any_of(\n&quot;));
</code></pre>
<p>Wenn du allerdings nach einer C-Lösung suchst, ist strtok was für dich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2055683</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2055683</guid><dc:creator><![CDATA[antiwort]]></dc:creator><pubDate>Thu, 28 Apr 2011 17:11:23 GMT</pubDate></item><item><title><![CDATA[Reply to text auf zeichen aufteilen on Thu, 28 Apr 2011 17:31:11 GMT]]></title><description><![CDATA[<p>antiwort schrieb:</p>
<blockquote>
<pre><code class="language-cpp">std::vector&lt;std::string&gt; aufgeteilt;
boost::split(str, &quot;string to split&quot;, boost::is_any_of(\n&quot;));
</code></pre>
<p>Wenn du allerdings nach einer C-Lösung suchst, ist strtok was für dich.</p>
</blockquote>
<p>-) boost-lib installieren.<br />
-) #include &lt;boost/algorithm/string.hpp&gt; + #include &lt;vector&gt; + #include &lt;string&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2055692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2055692</guid><dc:creator><![CDATA[Nachtrag-Von-Mir]]></dc:creator><pubDate>Thu, 28 Apr 2011 17:31:11 GMT</pubDate></item><item><title><![CDATA[Reply to text auf zeichen aufteilen on Thu, 28 Apr 2011 17:32:17 GMT]]></title><description><![CDATA[<p>Mit Standardmitteln:</p>
<pre><code class="language-cpp">#include &lt;deque&gt;
#include &lt;sstream&gt;
#include &lt;string&gt;

// ...

std::istringstream tokenizer(&quot;123\n456\n789\n&quot;);
std::string token;
std::deque&lt;std::string&gt; token_list;

// Wenn nicht nach \n, sondern nach einem anderen Zeichen gesplittet werden soll:
// while(std::getline(tokenizer, token, trenner)) {
while(std::getline(tokenizer, token)) {
  token_list.push_back(token);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2055694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2055694</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Thu, 28 Apr 2011 17:32:17 GMT</pubDate></item></channel></rss>