Return to Snippet

Revision: 19221
at October 18, 2009 08:24 by gerhardsletten

Initial Code
#import <Cocoa/Cocoa.h>
@interface NSString (Utilities)
- (BOOL) isURL;

#import "NSString-Utilities.h"
@implementation NSString (Utilities)

- (BOOL) isURL {
    if ( [self hasPrefix:@"http://"] )
        return YES;
        return NO;

// To use this:

NSString* string1 = @"";
NSString* string2 = @"Pixar";

if ( [string1 isURL] )
    NSLog (@"string1 is a URL");

if ( [string2 isURL] )
    NSLog (@"string2 is a URL");

Initial URL

Initial Description

Initial Title
Categories in Objective-C

Initial Tags

Initial Language
Objective C