//
//  NSStringAdditions.m
//  Scrabbalize
//
//  Created by Robert Sesek on 12/17/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "NSStringAdditions.h"


@implementation NSString (NSStringAdditions)

/**
 * Counts the number of times a given character is in the string
 */
- (int)occurrenceOfChar:(NSString *)aChar
{
	int count = 0;
	
	for (int i = 0; i < [self length]; i++)
	{
		if ([[self substringWithRange:NSMakeRange(i, 1)] isEqualToString:aChar])
		{
			count++;
		}
	}
	
	return count;
}

@end
