Table of Contents

# $EPIC: right.txt,v 1.4 2006/08/19 06:21:24 sthalik Exp $

Synopsis:

$right(<count> <text>)

Technical:

Practical:

Whenever you need to extract the trailing part of a string, you would use this function to get it. This is more useful for fixed-format strings. In ircII, you would use $mid($index(<char> <text>) 9999 <text>) to extract the part of <text> that was after <char>. In EPIC, you would use $after(<char> <text>) because it is faster, more clear, does not have any string limits, and avoids having two copies of <text>. This can be important if <text> is a function call.

Returns:

The last <count> characters in <text>. No padding is done. If you need a string that is exactly <count> characters, try:

$pad(<count> “ ” $right(<count> <text>))

Examples:

$right(5 biklmnopstv)                       returns "opstv"
$right(15 biklmnopstv)                      returns "biklmnopstv"
$right(-2 biklmnopstv)                      returns ""

$mid($index(@ $userhost()) 999 $userhost()) returns a hostname in an /on.
Note that this construction is obsolete, but is still used by some.

History:

This function first appeared in ircII.