/* * ----------------------------------------------------------------- * Execution of this macro requires a license for uni-XEDIT Extended * for each concurrent user of the macro. * ----------------------------------------------------------------- * * * * MSPLIT.XEDIT * * MSPLIT.XEDIT is a macro that will split a line into two lines * either BEFORE or AFTER encountering a specified character string. * * When typed on the command line, MSPLIT only looks for the first * occurrence of a specified string on the current line. If MSPLIT * is called from another macro, the calling macro must determine the * line on which MSPLIT will operate and position the file accordingly. * * MSPLIT does not split a line according to column pointer or cursor * position. Execute the MSPLIT.XEDIT macro by typing * * MSPLIT BEFORE // * AFTER * * where is the character string the macro will seek before * splitting a line. You cannot use `/' as one of the characters * in . * * * Modification History: * * 03/01/93 twg Initial implementation * 05/11/93 twg Minor refinement */ /* Begin macro... */ trace o 'set linend off' /* in case the line includes a '#'. */ parse arg word '/'string'/' if upper(word) = 'AFTER' then offset = length(string) else if upper(word) = 'BEFORE' then offset = 0 else offset = 0 'extract /curline' recin = curline.3 xpos = pos(string,recin) if xpos = 0 then return 2 recout = substr(recin,1,xpos+offset-1) 'replace' recout recrest = substr(recin,xpos+offset,length(recin)-length(recout)) 'in' recrest 'set linend on'