Sha256: 0fddf32a289c28374065d32f3938df8b5b36a5e0e6a75207435ba7812c1f0aa3

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

//
//  NSStringWhiteSpace.m
//  YueBao
//
//  Created by <%= @developer.capitalize %> on <%= @created_on %>
//  Copyright(c) <%= Time.now.year %>, All rights reserved.
//

#import "NSStringWhiteSpace.h"


@implementation NSString (Whitespace)

- (NSString *)stringByCompressingWhitespaceTo:(NSString *)seperator
{
	NSArray *comps = [self componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
	NSMutableArray *nonemptyComps = [[[NSMutableArray alloc] init] autorelease];
	
	// only copy non-empty entries
	for (NSString *oneComp in comps)
	{
		if (![oneComp isEqualToString:@""])
		{
			[nonemptyComps addObject:oneComp];
		}
		
	}
	
	return [nonemptyComps componentsJoinedByString:seperator];  // already marked as autoreleased
}
@end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
appjam-0.1.2 lib/appjam/generators/project/utils/NSStringWhiteSpace.m
appjam-0.1.1 lib/appjam/generators/project/utils/NSStringWhiteSpace.m