Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixed `NSString normalizedDescription` to properly handle long words.

  • Loading branch information...
commit f0cffab9ee670ce2ca9a636829a4cde5c4900d64 1 parent a0ed655
@tomaz authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 Common/NSString+GBString.m
4 Common/NSString+GBString.m
@@ -78,6 +78,10 @@ - (NSString *)normalizedDescriptionWithMaxLength:(NSUInteger)length {
if ([suffix length] >= length) *stop = YES;
+ // Make sure we strip long words; note that we're casting to NSMutableString to prevent compiler warnings; although not good coding practice, it's safe in this case...
+ if ([prefix length] > length) prefix = (NSMutableString *)[prefix substringToIndex:length];
+ if ([suffix length] > length) suffix = (NSMutableString *)[suffix substringToIndex:length];
return [NSString stringWithFormat:@"%@%@", prefix, suffix];
Please sign in to comment.
Something went wrong with that request. Please try again.