Permalink
Browse files

Merge pull request #124 from ikesyo/master

Fix spec description
  • Loading branch information...
2 parents c469c2d + 97f4cbd commit 864aba4a01201efd0d1691675f4f38b8dc7a4ca0 Allen Ding committed Apr 30, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 Kiwi/KWSpec.m
View
@@ -64,10 +64,9 @@ - (NSString *)description
name = [name stringByReplacingOccurrencesOfString:@"," withString:@"_"];
// Strip out characters not legal in function names
- NSMutableCharacterSet *illegalCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
- [illegalCharacters addCharactersInString:@"_()"];
- [illegalCharacters invert];
- name = [[name componentsSeparatedByCharactersInSet:illegalCharacters] componentsJoinedByString:@""];
+ NSError *error = nil;
+ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"[^a-zA-Z0-9_]*" options:0 error:&error];
+ name = [regex stringByReplacingMatchesInString:name options:0 range:NSMakeRange(0, name.length) withTemplate:@""];
return [NSString stringWithFormat:@"-[%@ %@]", NSStringFromClass([self class]), name];
}

0 comments on commit 864aba4

Please sign in to comment.