![]() |
Ansi <-> IBMAscii
Delphi-Quellcode:
HINWEIS! //Um Eventuelle Fehler auszuschliessen
function AnsiToIBMAscii(s: string): string;
var ii: integer; begin Result := ''; for ii := 0 to Length(s) do begin case s[ii] of #196: Result := Result + #142; //Ä #214: Result := Result + #153; //Ö #220: Result := Result + #154; //Ü #228: Result := Result + #132; //ä #246: Result := Result + #148; //ö #252: Result := Result + #129; //ü #223: Result := Result + #225; //ß else Result := Result + s[ii]; end; end; end; function IBMAsciiToAnsi(s: string): string; var ii: integer; begin Result := ''; for ii := 0 to Length(s) do begin case s[ii] of #142: Result := Result + #196; //Ä #153: Result := Result + #214; //Ö #154: Result := Result + #220; //Ü #132: Result := Result + #228; //ä #148: Result := Result + #246; //ö #129: Result := Result + #252; //ü #225: Result := Result + #223; //ß else Result := Result + s[ii]; end; end; end; Die Schleifen gehen in diesem Beispiel von "0 to Length(s)". Normalerweise gehen aber Schleifen von "0 to Length(s) -1" oder "1 to Length(s)", je nachdem wie man es haben will. Das wie und was man als Variable "s" übergibt ist wichtig und dementsprechend ist die Zeile zu ändern. Grüsse, Daniel :hi: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:32 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz