$truncate - Limit a string

By Jonesy44 on Jan 07, 2009

Short snippet to limit a string's length. the idea is derrived from webpages which show the start of an article or phrase/etc.. this is the mIRC version


  where the letters represent;
    N - max length of string
    T - text to limit

    c - counts spaces as a character ($chr(32))
    e - removes ellipsis from the end (the "..")


alias truncate {
  if ($isid) {
    if ($1 !isnum) { return 2* $truncate: incorrect paramater $+($qt($1),;) $truncate(maxlength,text) }
    else { return $mid($2-,0,$iif(c isin $prop,$calc($1 + $numtok($mid($2-,0,$1),32)),$1)) $iif(e !isin $prop,$iif($len($2-) > $1,..)) }
  else { echo -a 2* $!truncate: error; this alias can only be used as an identifier ($truncate form) }


Sign in to comment.
Jonesy44   -  Mar 09, 2009

Ay, it made me lol :P

Kirby   -  Mar 08, 2009

Feety's avatar image is pwn. D:

Jonesy44   -  Mar 08, 2009

No worries, thanks for the +like too. loving that pic btw :L

Feety   -  Mar 08, 2009

Great script, thank you.

Jonesy44   -  Jan 08, 2009

ty :)

KronicDreamer   -  Jan 08, 2009

i use something very similiar w/ my theme i been working on for long nicks...

Looks good

Jonesy44   -  Jan 08, 2009

No comments? .. :(

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.