Midstr (MPI)
From Tapestries MUCK
Line 1: | Line 1: | ||
- | [[Category: | + | [[Category:functions (MPI)]][[Category:String Functions (MPI)]] |
=midstr= | =midstr= | ||
<mpi>{midstr:str,pos} | <mpi>{midstr:str,pos} |
Latest revision as of 01:40, 31 March 2007
midstr
{midstr:str,pos} {midstr:str,pos1,pos2}
Returns the substring that starts at pos1 within str.
If no pos2 is given, then the returned string is only the character at the given pos1 position. if a pos2 position is given, then it returns the substring beginning at pos1 and ending at pos2, inclusive. If pos1 or pos2 are negative, then they represent the position that is that absolute number of characters from the end of the string. The first character in str is 1, and the last one can always be referenced by -1.
If a position would be before the beginning of the string, it is assumed to be at the beginning of the string. If it would be beyond the end of the string, it is assumed to be at the last character.
If the starting position is later in the string than the ending position, then the returned string has the characters in reverse order. If either pos1 or pos2 are 0, then this returns a null string. ("")