Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.1

# StrPtr::operators ==, !=, >, <, <=, >= ( const char * )

Case-sensitive comparison operators between `StrPtr` and `char *`.

Virtual? | No |
Class | `StrPtr` |
Arguments | `const char *buf` | the string to compare with
Returns | `int` | 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

Copy

    #include &lt;stdhdrs.h&gt;
    #include &lt;strbuf.h&gt;

    int main( int argc, char **argv )
    {
        StrBuf str1;

        str1.Set( "This string" );

        printf( "%s", str1.Text());
        if ( str1 == "that string" ) printf( " == " );
        if ( str1 &gt; "that string" )  printf( " &gt; " );
        if ( str1 &lt; "that string" )  printf( " &lt; " );
        printf( "that string" );
        return 0;
    }

Executing the preceding code produces the following output:

    This string < that string

(Note that “t” > “T” in ASCII.)

Your search for returned results