# $EPIC: left.txt,v 1.4 2006/08/01 04:12:59 sthalik Exp $
$left(<count> <text>)
Whenever you need to extract the initial part of a string, you would use this function to get it. This is more useful for fixed-format strings. ircII used to use $left($index(<char> <text>) <text>) to extract the part of <text> that was before <char>. In EPIC, use $before(<char> <text>) because it is faster, more clear, and doesn't require two copies of <text>, which may be important if <text> is a function call.
The first <count> characters in <text>. No padding is done. If you need a string that is always <count> characters long, try:
$pad(<count> " " $left(<count> <text>))
$left(5 biklmnopstv) returns "biklm" $left(15 biklmnopstv) returns "biklmnopstv" $left(-2 biklmnopstv) returns nothing $left($index(@ $userhost()) $userhost()) returns a username in an /on. -- Note that this construction is obsolete, but is still used by some.
This function first appeared in ircII.