module cleanup; type line = packed array [1..78] of char; [external] procedure makelower (var c: char); extern; [global] procedure clean (var source: line; count: integer); { CLEAN replaces punctuation marks with spaces in the source line } { It also converts any uppercase letters to lowercase using the assembly procedure MAKELOWER. } { Finally, it replaces the terminator (usually a carriage return - chr(13)) with a space. } var j: integer; c: char; punc: set of char; upper: set of char; begin punc := ['.', ',', ';', ':', '?', '!', '-', '(', ')', '"', '''']; upper := ['A'..'Z']; for j := 1 to count do begin c := source[j]; if c in punc then c := ' ' else if c in upper then makelower(c); source[j] := c; end; source[count+1] := ' '; end; end.