EnableExplicit DataSection STR1: Data.s "" STR2: Data.s "'If I were two-faced, would I be wearing this one?' --- Abraham Lincoln " STR3: Data.s "..1111111111111111111111111111111111111111111111111111111111111117777888" STR4: Data.s "I never give 'em hell, I just tell the truth, and they think it's hell. " STR5: Data.s " --- Harry S Truman " EndDataSection Procedure.s collapse(txt$) Define *c.Character=@txt$, last.c=0, result$ While *c\c If *c\c<>last result$+Chr(*c\c) last=*c\c EndIf *c+SizeOf(Character) Wend ProcedureReturn result$ EndProcedure OpenConsole("") Define *p_data=?STR1, buf$ While *p_data<=?STR4+StringByteLength(PeekS(?STR4))+2 buf$=PeekS(*p_data) PrintN("Before collapse: «««"+buf$+"»»» (length: "+Str(Len(buf$))+")") buf$=collapse(PeekS(*p_data)) PrintN("After collapse: «««"+buf$+~"»»» (length: "+Str(Len(buf$))+~")\n") *p_data+StringByteLength(PeekS(*p_data))+2 Wend Input()