<?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[C-Strings oder string Datentyp ???]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ein anderes Problem:<br />
In C++ kann ich einen String mittels strtok auseinanderpflücken,<br />
Und zwar, wenn ich habe<br />
hallowelt.jpg<br />
und<br />
hallokarl.jpg<br />
kann ich die beiden Strings auf hallowelt und hallokarl verkürzen um diese so besser mit strCompare vergleichen zu können.</p>
<p>meine Strings sind in diesem Fall aber char*.</p>
<p>Gibt es die Möglichkeit das Ganze mit Hilfe des Datentyps String zu verwirklichen?</p>
<p>Vielen Dank<br />
Tina</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/138755/c-strings-oder-string-datentyp</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 05:15:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/138755.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 28 Feb 2006 22:22:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C-Strings oder string Datentyp ??? on Tue, 28 Feb 2006 22:22:14 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ein anderes Problem:<br />
In C++ kann ich einen String mittels strtok auseinanderpflücken,<br />
Und zwar, wenn ich habe<br />
hallowelt.jpg<br />
und<br />
hallokarl.jpg<br />
kann ich die beiden Strings auf hallowelt und hallokarl verkürzen um diese so besser mit strCompare vergleichen zu können.</p>
<p>meine Strings sind in diesem Fall aber char*.</p>
<p>Gibt es die Möglichkeit das Ganze mit Hilfe des Datentyps String zu verwirklichen?</p>
<p>Vielen Dank<br />
Tina</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005574</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005574</guid><dc:creator><![CDATA[Tina]]></dc:creator><pubDate>Tue, 28 Feb 2006 22:22:14 GMT</pubDate></item><item><title><![CDATA[Reply to C-Strings oder string Datentyp ??? on Tue, 28 Feb 2006 22:36:54 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>natürlich geht das mit den std::string-<a href="http://www.cppreference.com/cppstring/index.html" rel="nofollow">Methoden</a>.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005578</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005578</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 28 Feb 2006 22:36:54 GMT</pubDate></item><item><title><![CDATA[Reply to C-Strings oder string Datentyp ??? on Tue, 28 Feb 2006 22:52:10 GMT]]></title><description><![CDATA[<p>Z.B. so</p>
<pre><code class="language-cpp">Deque&lt;String&gt; tokenize(const String&amp; str, const String&amp; delimiters) {
	Deque&lt;String&gt; q;
	uint index = 0;
	uint pos = 0;
	String s = trim(str);
	while (pos != String::npos) {
		pos = s.find_first_of(delimiters, index);
		if (pos == index) {
			if (s.at(pos) == ' ') {
				index = pos + 1;
			} else {
				q.push_back(s.substr(index, 1));
				index = pos + 1;
			}
		} else if (pos == String::npos) {
			q.push_back(s.substr(index));
			break;
		} else {
			q.push_back(s.substr(index, pos - index));
			index = pos;
		}
	}
	return q;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1005580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005580</guid><dc:creator><![CDATA[Apollon]]></dc:creator><pubDate>Tue, 28 Feb 2006 22:52:10 GMT</pubDate></item><item><title><![CDATA[Reply to C-Strings oder string Datentyp ??? on Tue, 28 Feb 2006 23:25:41 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;vector&gt;
#include &lt;string&gt; 

/*
  Split() teilt einen string an einem bestimmten Zeichen in kleine Teile. 
  str     ist der zu teilende String vom Typ std::string
  token   ist das Trennzeichen
  res     referenz auf einen Stringvektor vom Typ std::vector&lt;std::string&gt;
*/
void Split( std::string const &amp; str , char token , std::vector&lt;std::string&gt; &amp; res )
{
  std::string::size_type pos  = std::string::npos , last = 0; 

  while( (pos = str.find( token , last = pos + 1 )) != std::string::npos )
     res.push_back(str.substr(last,pos - last));

  res.push_back(str.substr(last));
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1005594</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005594</guid><dc:creator><![CDATA[evilissimo]]></dc:creator><pubDate>Tue, 28 Feb 2006 23:25:41 GMT</pubDate></item><item><title><![CDATA[Reply to C-Strings oder string Datentyp ??? on Wed, 01 Mar 2006 06:19:16 GMT]]></title><description><![CDATA[<p>In den boost Libs gibts genug splitter und tokenizer.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005630</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Wed, 01 Mar 2006 06:19:16 GMT</pubDate></item><item><title><![CDATA[Reply to C-Strings oder string Datentyp ??? on Wed, 01 Mar 2006 07:03:44 GMT]]></title><description><![CDATA[<p>hm....also wenn ich nur das .jpg weg machen wollte, dann würede ich wohl einfach find_first_of() und substr() oder sowas nehmen...hm...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1005642</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1005642</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Wed, 01 Mar 2006 07:03:44 GMT</pubDate></item></channel></rss>