Chromatic   -  Nov 19, 2013

Hey guys -- Anyone have a good snippet to limit the output to X lines or Y characters? IE: Anything that exceeds X character/words/lines is cut off.

The purpose is to limit scripts in a chat channel from outputting too much data,.. ie: Using say Wolframalpha some searches are quite short in their resulting output,.. but some searches (not intended to spam) can output 25 lines or more of text spamming the channel.

Any code to paste in the scripts I need to limit the output would be appreciated -- or even just a link to a snippet/code already on here that has the code in it to limit output so I can dig it out myself would be fine.

Appreciate any help.

Sorasyn  -  Nov 19, 2013

Jonesy44 made this awhile back. It looks to be what you're wanting. It truncates a string to certain length, preventing overflow.

http://www.hawkee.com/snippet/5579/

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.