advertisement

Article:
  Strings in Cocoa: Part I
Subject:   Comparing strings
Date:   2001-06-30 13:15:07
From:   nriley
char string1[] = "Yo";
char string2[] = "Yo";
if ( string1 == string2 ) {
// do the following code
}


And the conditional would evaluate to "true", executing the code within the braces of the if statement.


Er, yes, but only if the compiler decides to share the area of memory used by the string constants. The equivalent of compare: for C strings is strcmp.


I'm enjoying your article series - keep it up!


--Nicholas


1 to 3 of 3
  1. Comparing strings
    2001-07-04 18:34:01  bigboytoddy [View]

  2. Comparing strings
    2001-07-02 07:41:35  canyonrat [View]

    • Comparing strings
      2001-07-03 14:38:00  wcray [View]

      • Comparing strings
        2001-07-03 16:44:43  canyonrat [View]

        • Comparing strings
          2001-07-04 18:36:41  bigboytoddy [View]

          • Comparing strings
            2001-07-04 23:33:56  canyonrat [View]

      • Michael Beam photo Comparing strings
        2001-07-03 15:53:58  Michael Beam | O'Reilly Author [View]

  3. Michael Beam photo Comparing strings
    2001-06-30 22:07:07  Michael Beam | O'Reilly Author [View]

1 to 3 of 3