Finished the algorithm for checking the words. We now make sure the word isn't too...
[scrabbalize.git] / Source / NSStringAdditions.m
1 //
2 // NSStringAdditions.m
3 // Scrabbalize
4 //
5 // Created by Robert Sesek on 12/17/07.
6 // Copyright 2007 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "NSStringAdditions.h"
10
11
12 @implementation NSString (NSStringAdditions)
13
14 /**
15 * Counts the number of times a given character is in the string
16 */
17 - (int)occurrenceOfChar:(NSString *)aChar
18 {
19 int count = 0;
20
21 for (int i = 0; i < [self length]; i++)
22 {
23 if ([[self substringWithRange:NSMakeRange(i, 1)] isEqualToString:aChar])
24 {
25 count++;
26 }
27 }
28
29 return count;
30 }
31
32 @end