More Token Identifers

By Zach on Nov 16, 2003

;More Token Identifiers...
;Just to use if you ever need them
;Also to show what you can do with tokens to newbies...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Created By: Aeter

; $randtok(Text,C) 
; Returns a random token from Text.
alias randtok { 
  if ($isid) { 
    if (!$1) { echo -s $eval($randtok,0) first paremeter is blank. | halt }
    else { 
      if (!$2) { echo -s $eval($randtok,0) second paremeter is blank. | halt }
      else { 
        return $gettok($$1,$rand(1,$numtok($$1,$$2)),$$2) 
      }
    }
  }
}

;$midtok(Text,C) 
;Returns middle token from text.
alias midtok { 
  if ($isid) { 
    if (!$1) { echo -s $eval($midtok,0) first paremeter is blank. | halt }
    else { 
      if (!$2) { echo -s $eval($midtok,0) second paremeter is blank. | halt }
      else { 
        return $gettok($$1,$round($calc($numtok($$1,$$2) / 2),0),$$2) 
      }
    }
  }
}

;$firsttok(Text,C) 
;Returns first token of Text.
alias firsttok { 
  if ($isid) { 
    if (!$1) { echo -s $eval($firsttok,0) first paremeter is blank. | halt }
    else { 
      if (!$2) { echo -s $eval($firsttok,0) second paremeter is blank. | halt }
      else { 
        return $gettok($$1,1,$$2) 
      }
    }
  }
}
;$lasttok(Text,C)
;Returns last token of Text
alias lasttok { 
  if ($isid) { 
    if (!$1) { echo -s $eval($lasttok,0) first paremeter is blank. | halt }
    else { 
      if (!$2) { echo -s $eval($lasttok,0) second paremeter is blank. | halt }
      else { 
        return $gettok($$1,$numtok($$1,$$2),$$2) 
      }
    }
  }
}

Comments

Sign in to comment.
blue-elf   -  Dec 18, 2003

lasttok { return $gettok($1,-1,$2) }

 Respond  
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.