Site Tools


right
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


right [2006/08/29 16:08] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +# $EPIC: right.txt,v 1.4 2006/08/19 06:21:24 sthalik Exp $
 +======Synopsis:======
 +$__right__(<count> <text>)
 +
 +======Technical:======
 +   * If <count> is omitted, this function returns the empty string.
 +   * If <text> is omitted, this function returns the empty string.
 +   * If <count> is less than 0, this function returns the empty string.
 +   * If <text> is more than <count> characters long, then this function will return a copy of the last <count> characters in <text>.
 +   * If <text> is less than or exactly <count> characters long, then this function will return a copy of <text>
 +
 +======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:======
 +<file>
 +$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.
 +</file>
 +
 +======History:======
 +This function first appeared in ircII.
  
right.txt · Last modified: 2006/08/29 16:08 by 127.0.0.1