StrPtr::operators ==, !=, >, <, <=, >= ( const char * )
Case-sensitive comparison operators between StrPtr
and
char *
.
Virtual? |
No |
|
Class |
||
Arguments |
|
the string to compare with |
Returns |
|
zero if the comparison is false, nonzero if true. |
Notes
These operators are typically used in simple comparisons between
StrPtr
s, such as to see whether two StrPtr
s
contain the same string, or whether one is greater than the other,
ASCII-wise. The comparison is always case-sensitive.
Example
#include <stdhdrs.h> #include <strbuf.h> int main( int argc, char **argv ) { StrBuf str1; str1.Set( "This string" ); printf( "%s", str1.Text()); if ( str1 == "that string" ) printf( " == " ); if ( str1 > "that string" ) printf( " > " ); if ( str1 < "that string" ) printf( " < " ); printf( "that string" ); return 0; }
Executing the preceding code produces the following output:
This string < that string
(Note that âtâ > âTâ in ASCII.)