mid
Table of Contents
# $EPIC: mid.txt,v 1.2 2006/08/01 05:15:58 sthalik Exp $
Synopsis:
$mid(<start> <length> <text>)
Technical:
- If <start> is omitted, this function returns the empty string.
- If <length> is omitted, this function returns the empty string.
- If <text> is omitted, this function returns the empty string.
- If <start> is greater than the number of characters in <text>, this function returns the empty string.
- If <length> is zero, this function returns the empty string.
- If <length> is negative, this function returns the empty string.
— THIS IS DIFFERENT FROM IRCII – SEE PRACTICAL SECTION — - Otherwise, this function skips over the first <start> characters in <text>, and then returns a copy of the next <length> characters after that. This means that <start> “counts from zero”.
Practical:
This function extracts a substring from a string. This can be used to strip out the first few characters of a function, or to get a field from a fixed-format string. Although ircII lets you specify a negative value for <length> to get the “rest” of the string, EPIC does not. If you need to get the “rest” of a string, use the $rest() function.
Returns:
A copy of a portion of <text>
Examples:
$mid(4 4 hello there) returns "o th" $mid(7 100 this is a long string) returns " a long string" $mid(7 -1 this is a long string) returns ""
History:
This function first appeared in ircII.
mid.txt · Last modified: 2006/08/01 20:54 by 127.0.0.1