String: equals : string compare : string : C++ examples (example source code) Organized by topic

C++
PHP


C++  »  string   » [  string compare  ]  Screenshots 
 



String: equals
 
 
#include <iostream.h>
#include <string>
using std::string;

main(void)
{
   string s1 = "abcdefghijk", s2 = "1234567890", s3,s4,s5;

   s3=s1+s2;
   cout << s3 <<endl;

   s4=s3;
   if (s4==s3
      cout << " s4==s3 is true\n";

   return(0);
}

/* 
abcdefghijk1234567890
 s4==s3 is true

*/
        
  
Related examples in the same category
1.  string overloaded equality and relational operators
2.  Compare string ignoring the case
3.  Compare sub string: string4.compare( 0, string2.length(), string2 )
4.  Use == > and < to compare strings
5.  Use string.compare to compare two strings
6.  Compare strings by index: string1.compare( 2, 5, string3, 0, 5)
7.  Set with functor for string comparison
8.  Use std::lexicographical_compare to compare two char arrays
























Home| Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.