NAME

midS2 - replace middle portion of string

SYNOPSIS

#include <basic/string.h>

midS2(s, t, n, m, flag)
struct string *s, *t;
short n, m;
int flag;

DESCRIPTION

MidS2 replaces the portion of the string pointed to by s beginning at location n with the string pointed to by t.  The copy is performed in place, i.e., without re-allocating or moving the text buffer of the target string.  Locations are numbered starting with one.  If flag is set, the replacement consists the entire source string.  Otherwise the replacement is limited to m characters.  In any of these cases, if the replacement would extend beyond the end of the target string, the replacement is further limited to avoid this condition.  These cases are not errors. 

This function implements the MID$ statement. 

SEE ALSO

string(inc)
mid$(stmt)

DIAGNOSTICS

Error 5 (Illegal function call) is generated if n is non-positive or if flag is set and m is negative or if location n lies beyond the end of the target string.  The target string is not altered. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber