Skip to content

Instantly share code, notes, and snippets.

@maddievision
Created January 2, 2013 00:27
Show Gist options
  • Save maddievision/4431266 to your computer and use it in GitHub Desktop.
Save maddievision/4431266 to your computer and use it in GitHub Desktop.
NSString+WhitespaceUtil.m
+ (NSString*) stringByCompactingWhitespaces:(NSString*) theString {
return [[[theString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF != ''"]] componentsJoinedByString:@" "];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment