Skip to content

Instantly share code, notes, and snippets.

@maleko
Created November 24, 2008 22:54
Show Gist options
  • Save maleko/28673 to your computer and use it in GitHub Desktop.
Save maleko/28673 to your computer and use it in GitHub Desktop.
# To truncate an sms message before the 160 character limit and not a word in mid-sentence
text.scan(/.{1,160}(?=\s|$)/m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment