Skip to content

Instantly share code, notes, and snippets.

@rscarvalho
Created August 30, 2014 16:17
Show Gist options
  • Select an option

  • Save rscarvalho/7cd210f47cbe77e48db0 to your computer and use it in GitHub Desktop.

Select an option

Save rscarvalho/7cd210f47cbe77e48db0 to your computer and use it in GitHub Desktop.
NSString *text = [publicacao.texto
stringByTrimmingCharactersInSet:[NSCharacterSet
whitespaceAndNewlineCharacterSet]];
self.textLabel.text = [text substringToIndex:MIN(text.length, 80)];
if (text.length > 80) {
self.textLabel.text = [self.textLabel.text stringByAppendingString:@"..."];
}
text = publicacao.texto.strip
self.textLabel.text = text[0...([text.length, 80].min)]
self.textLabel.text += "..." if text.length > 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment