Skip to content

Commit b66760b

Browse files
committed
Fixes #9, removed cString from closing bracket search method
1 parent bf2ce73 commit b66760b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

SCXcodeSwitchExpander/DVTTextCompletionController+SCXcodeSwitchExpander.m

+3-5
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ - (NSUInteger)matchingBracketLocationForOpeningBracketLocation:(NSUInteger)locat
165165
if(string.length == 0) {
166166
return NSNotFound;
167167
}
168-
169-
const char *cString = [string cStringUsingEncoding:NSUTF8StringEncoding];
170168

171169
NSInteger matchingLocation = location;
172170
NSInteger counter = 1;
@@ -177,12 +175,12 @@ - (NSUInteger)matchingBracketLocationForOpeningBracketLocation:(NSUInteger)locat
177175
return NSNotFound;
178176
}
179177

180-
char character = cString[matchingLocation];
178+
NSString *character = [string substringWithRange:NSMakeRange(matchingLocation, 1)];
181179

182-
if (character == '{') {
180+
if ([character isEqualToString:@"{"]) {
183181
counter++;
184182
}
185-
else if (character == '}') {
183+
else if ([character isEqualToString:@"}"]) {
186184
counter--;
187185
}
188186
}

0 commit comments

Comments
 (0)