<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://programmingexamples.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FSTL%2FString</id>
		<title>CPP/STL/String - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://programmingexamples.net/w/index.php?action=history&amp;feed=atom&amp;title=CPP%2FSTL%2FString"/>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/STL/String&amp;action=history"/>
		<updated>2026-06-13T12:00:30Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.5</generator>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=CPP/STL/String&amp;diff=599&amp;oldid=prev</id>
		<title>Daviddoria at 22:35, 27 January 2011</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/STL/String&amp;diff=599&amp;oldid=prev"/>
				<updated>2011-01-27T22:35:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 22:35, 27 January 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==String.cpp==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==String.cpp==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;cmake&lt;/del&gt;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;cpp&lt;/ins&gt;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;iostream&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;iostream&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;string&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;string&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	<entry>
		<id>http://programmingexamples.net/w/index.php?title=CPP/STL/String&amp;diff=10&amp;oldid=prev</id>
		<title>Daviddoria: Created page with '==String.cpp== &lt;source lang=&quot;cmake&quot;&gt; #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;algorithm&gt; #include &lt;functional&gt;  void TestEmpty(); void TestConcatenate(); void RemoveCharac…'</title>
		<link rel="alternate" type="text/html" href="http://programmingexamples.net/w/index.php?title=CPP/STL/String&amp;diff=10&amp;oldid=prev"/>
				<updated>2010-06-22T20:25:25Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;==String.cpp== &amp;lt;source lang=&amp;quot;cmake&amp;quot;&amp;gt; #include &amp;lt;iostream&amp;gt; #include &amp;lt;string&amp;gt; #include &amp;lt;algorithm&amp;gt; #include &amp;lt;functional&amp;gt;  void TestEmpty(); void TestConcatenate(); void RemoveCharac…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==String.cpp==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;lt;algorithm&amp;gt;&lt;br /&gt;
#include &amp;lt;functional&amp;gt;&lt;br /&gt;
&lt;br /&gt;
void TestEmpty();&lt;br /&gt;
void TestConcatenate();&lt;br /&gt;
void RemoveCharacters();&lt;br /&gt;
void Compare();&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char *argv[])&lt;br /&gt;
{&lt;br /&gt;
  //TestEmpty();&lt;br /&gt;
  //TestConcatenate();&lt;br /&gt;
  //RemoveCharacters();&lt;br /&gt;
  Compare();&lt;br /&gt;
	&lt;br /&gt;
  return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Compare()&lt;br /&gt;
{&lt;br /&gt;
  {&lt;br /&gt;
  std::string String1 = &amp;quot;test&amp;quot;;&lt;br /&gt;
  std::string String2 = &amp;quot;hello&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  if (std::equal(String1.begin(), String1.end(), String2.begin()))&lt;br /&gt;
  {&lt;br /&gt;
   std::cout &amp;lt;&amp;lt; &amp;quot;Match&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
  else&lt;br /&gt;
  {&lt;br /&gt;
   std::cout &amp;lt;&amp;lt; &amp;quot;No match.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  {&lt;br /&gt;
  std::string String1 = &amp;quot;test&amp;quot;;&lt;br /&gt;
  std::string String2 = &amp;quot;test&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  if (std::equal(String1.begin(), String1.end(), String2.begin()))&lt;br /&gt;
  {&lt;br /&gt;
   std::cout &amp;lt;&amp;lt; &amp;quot;Match&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
  else&lt;br /&gt;
  {&lt;br /&gt;
   std::cout &amp;lt;&amp;lt; &amp;quot;No match.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void RemoveCharacters()&lt;br /&gt;
{&lt;br /&gt;
  &lt;br /&gt;
  std::string MyString = &amp;quot;hello,world123&amp;quot;;&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Original: &amp;quot; &amp;lt;&amp;lt; MyString &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
      &lt;br /&gt;
  //Remove all punctuation&lt;br /&gt;
  MyString.erase(&lt;br /&gt;
  std::remove_if(MyString.begin(), MyString.end(), &amp;amp;ispunct), &lt;br /&gt;
  MyString.end());&lt;br /&gt;
  &lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Punctuation removed: &amp;quot; &amp;lt;&amp;lt; MyString &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  //Remove all numbers&lt;br /&gt;
  MyString.erase(&lt;br /&gt;
  std::remove_if(MyString.begin(), MyString.end(), &amp;amp;isdigit), &lt;br /&gt;
  MyString.end());&lt;br /&gt;
&lt;br /&gt;
  std::cout &amp;lt;&amp;lt; &amp;quot;Numbers removed: &amp;quot; &amp;lt;&amp;lt; MyString &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
&lt;br /&gt;
  //Remove non alphanumeric characters&lt;br /&gt;
  std::string::iterator rem = std::remove_if(MyString.begin(),MyString.end(),std::not1(std::ptr_fun(&amp;amp;::isalnum)));&lt;br /&gt;
  MyString.erase(rem, MyString.end());&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void TestEmpty()&lt;br /&gt;
{&lt;br /&gt;
  std::string test;&lt;br /&gt;
  &lt;br /&gt;
  if(test.empty())&lt;br /&gt;
  {&lt;br /&gt;
    std::cout &amp;lt;&amp;lt; &amp;quot;empty.&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void TestConcatenate()&lt;br /&gt;
{&lt;br /&gt;
  std::string a = &amp;quot;hello&amp;quot;;&lt;br /&gt;
  std::string b = &amp;quot;world&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  std::cout &amp;lt;&amp;lt; a+b &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daviddoria</name></author>	</entry>

	</feed>