Filter for Ascii and Ansi/de
Zurück zur Seite Code Beispiele.
Das Unterprogramm entfernt unerlaubte Steuerzeichen aus ASCII- und ANSI-Dateien.
uses
FileUtil, ...;
...
procedure subUnerlaubteSonderzeichenEntfernen(
const conStrQuellDatei, conStrZielDatei: string);
var
txtQuelldatei: file of char;
txtZieldatei: file of char;
chrZeichen: char;
begin
AssignFile(txtQuelldatei, UTF8ToSys(conStrQuellDatei));
Reset(txtQuelldatei);
AssignFile(txtZieldatei, UTF8ToSys(conStrZielDatei));
Rewrite(txtZieldatei);
Reset(txtZieldatei);
while not EOF(txtQuelldatei) do
begin
Read(txtQuelldatei, chrZeichen);
if (chrZeichen < #32) and (not (chrZeichen in [#9, #10, #13, #26])) then
else
Write(txtZieldatei, chrZeichen);
end;
CloseFile(txtQuelldatei);
CloseFile(txtZieldatei);
end;Aufruf unter Windows:
...
subUnerlaubteSonderzeichenEntfernen('E:\Test.txt', 'E:\Test1.txt');
...Aufruf unter Linux:
...
subUnerlaubteSonderzeichenEntfernen('/home/user/Test.txt', '/home/user/Test1.txt')
...From the Free Pascal wiki, page "Filter for Ascii and Ansi/de", as it stood on 2020-02-15 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Edited on wiki.freepascal.org by 4 people, 2013–2020
From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.
| When | Who | What changed |
|---|---|---|
| Olaf | Created page | |
| Olaf | (minor) | |
| Olaf | (minor) | |
| Billyraybones | consistent naming (minor) | |
| Olaf | (minor) | |
| Olaf | (minor) | |
| FTurtle | ||
| Trev | Fixed syntax highlighting; deleted category included in page template (minor) |
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
