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
|
Showing messages 1 through 8 of 8.
-
Comparing strings
2001-07-04 18:34:01
bigboytoddy
[View]
-
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]
\t