Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
Untitled
a guest
Feb 21st, 2018
61
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
text
0.19 KB
| None
|
0
0
raw
download
clone
embed
print
report
def truncate_words(text, length = 30, truncate_string = "..." )
return if text.nil?
words = text.split
words.length > length ? words[0...length].join(" ") + truncate_string : text
end
Add Comment
Please,
Sign In
to add comment
Public Pastes
Swimbot Error
Python | 26 min ago | 0.67 KB
🤑 G2A.com Free Gift Card Guide May 2024 FIX 🤑
GetText | 31 min ago | 0.39 KB
Ps99 Script
Lua | 38 min ago | 0.08 KB
Decimal to Roman
PHP | 51 min ago | 2.53 KB
Brave new world
C# | 1 hour ago | 6.10 KB
Slot Disk Writer
Lua | 1 hour ago | 1.36 KB
Untitled
HTML | 1 hour ago | 2.64 KB
Abre IMGUR
Python | 1 hour ago | 1.27 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!