Sha256: 676400d53092fdae0debfc72dfa51b31b41c9fc07589ed095eddaa1d3c30306d

Contents?: true

Size: 981 Bytes

Versions: 4

Compression:

Stored size: 981 Bytes

Contents

//
//  NSString+ObjectiveSugar.m
//  SampleProject
//
//  Created by Neil on 05/12/2012.
//  Copyright (c) 2012 @mneorr | mneorr.com. All rights reserved.
//

#import "NSString+ObjectiveSugar.h"
#import "NSArray+ObjectiveSugar.h"

NSString *NSStringWithFormat(NSString *formatString, ...) {
    va_list args;
    va_start(args, formatString);
    
    NSString *string = [[NSString alloc] initWithFormat:formatString arguments:args];
    
    va_end(args);
    
#if defined(__has_feature) && __has_feature(objc_arc)
    return string;
#else 
    return [string autorelease];
#endif
}


@implementation NSString(Additions)

- (NSArray *)split {
    return [self split:@" "];
}

- (NSArray *)split:(NSString *)delimiter {
    NSArray *result = [self componentsSeparatedByCharactersInSet:
                            [NSCharacterSet characterSetWithCharactersInString:delimiter]];

    return [result select:^BOOL(NSString *string) {
        return string.length > 0;
    }];
}

@end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
appjam-0.1.8.11 lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSString+ObjectiveSugar.m
appjam-0.1.8.10 lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSString+ObjectiveSugar.m
appjam-0.1.8.9 lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSString+ObjectiveSugar.m
appjam-0.1.8.8 lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/ObjectiveSugar/NSString+ObjectiveSugar.m