Created
August 4, 2016 02:48
-
-
Save edwinlab/164f75203e45de4561aebbfb5b140d43 to your computer and use it in GitHub Desktop.
Truncate with regex to detection word
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Once upon a time in a world far far away'.truncate(20, separator: /\s/) | |
# "Once upon a time..." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment