"If", a string, and NSTextField in Cocoa

rhale1

KU Mac Geek
*Code included below:

I want my if statement to check if the regiterField is equal to the string (declared with NSString, red when used in the 'if' statement). How do I get them to agree?

Code:
- (IBAction)registerAction:(id)sender
{
    NSString *code = @"dxs-ce-01-12345";
    
    if ([[registerField stringValue] [COLOR=crimson]code[/COLOR]])
    {
    }
}
 
I think u need to do some more wonk on your own. If you've installed the developer CD, all the documentation is stored in /Developer/Documentation/Cocoa/Reference Just look at the NSString docs in the reference section; it's painfully obvious.

Just trying to kick you in the right direction,
F-bacher
 
you can use :

- (IBAction)registerAction:(id)sender
{
NSString *code = @"dxs-ce-01-12345";

if ([[registerField stringValue] isEqualToString:code])
{
do something here....
}
}
 
I have learn the obj C ...and cocoa..only using the "Developper help center".....if you nedd help....email me...
cthulhu77@libero.it....(i will try to answer)

PS: excuse me for my english ..i'm italian...:D
 
Well, if you just go ahead and tell him, how is he/she ever going to learn?

By repeatedly making use of what he was told!
 
Back
Top