>lcEnd='^^^' >lcFile = 'yourfile' >lcLines = STRTOFILE(lcFile) > > >lnLines = ALINES(laLines,lcLines,18) >lcLines = '' >*test for several Filetypes >DO CASE > CASE lnLines=1 >*just a single line > CASE 0h0D0A=RIGHT(laLines(1),2) > lcLineEnd = ''+0h0D0A > CASE 0h0A0D=RIGHT(laLines(1),2) > lcLineEnd = ''+0h0A0D > CASE 0h0D=RIGHT(laLines(1),1) > lcLineEnd = ''+0h0D > CASE 0h0A=RIGHT(laLines(1),1) > lcLineEnd = ''+0h0A >ENDCASE >FOR lnLine = 1 TO lnLines-1 > DO CASE > CASE laLines(lnLine)==lcLineEnd >*empty line > lcLines = lcLines+laLines(lnLine) > CASE lcEnd+lcLineEnd$laLines(lnLine) >*endchar exists > lcLines = lcLines+laLines(lnLine) > OTHERWISE >*non empty line without lcEnd > lcLines = lcLines+STRTRAN(laLines(lnLine),lcLineEnd,lcEnd+lcLineEnd) > ENDCASE >ENDFOR > >*last line >DO CASE > CASE laLines(lnLines)=="" >*empty line >*nothing to do > CASE RAT(laLines(lnLine),LEN(lcEnd))==lcEnd >*endchar exists > lcLines = lcLines+laLines(lnLine) > OTHERWISE >*non empty line without lcEnd > lcLines = lcLines+laLines(lnLine)+lcEnd >ENDCASE >STRTOFILE(lcLines,lcFile) >>