Skip to content

Instantly share code, notes, and snippets.

@taishi41228
Created March 16, 2013 08:49
Show Gist options
  • Save taishi41228/5175567 to your computer and use it in GitHub Desktop.
Save taishi41228/5175567 to your computer and use it in GitHub Desktop.
文字列が等しいかどうか判断する簡単なプログラム ref: http://qiita.com/items/bd55613d94283a9f7dc0
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate> {
IBOutlet NSTextField* field1;
IBOutlet NSTextField* field2;
IBOutlet NSTextField* result;
}
@property (assign) IBOutlet NSWindow *window;
- (IBAction)isEqual:(id)sender;
@end
#import "AppDelegate.h"
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
}
- (IBAction)isEqual:(id)sender {
if ([[field1 stringValue] isEqualTo:[field2 stringValue]]) {
[result setStringValue:@"等しい"];
} else {
[result setStringValue:@"等しくない"];
}
}
@end
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment