/*------------------------------------------------------------------- xsubstr(x,startcol,length,padchar) returns string from within x starting at startcol for length characters padded with padchar if returned length does not match length If startcol = 0 then 1 is used If length = 0 then from startcol to end of string If padchar = "" then padchar becomes " " Mark McDonald 2008 -------------------------------------------------------------------*/ char *xsubstr(char *x, int xsp, int xn, char*xpad){ char *xret = ""; char *xpadchars =""; int xlen; xlen = strlen(x); if(xsp > xlen){return(xret);} if(xsp == 0){xsp = 1;} if(xpad == ""){strcpy(xpad," ");} /*Set Default if Needed*/ if(xn > 0){ xpadchars = strgenstr(xpad, xn); strcat(x,xpadchars); }//endif if(xn == 0){ xn = xlen - xsp + 1; }//endif xret = strgetsubstr(x,xsp,xn); return(xret); }//xsubstr