AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Ansi <-> IBMAscii

Ein Thema von Daniel B · begonnen am 28. Aug 2002
Antwort Antwort
Daniel B
(Gast)

n/a Beiträge
 
#1

Ansi <-> IBMAscii

  Alt 28. Aug 2002, 16:26
Delphi-Quellcode:
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;
HINWEIS! //Um Eventuelle Fehler auszuschliessen

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

Geändert von toms (28. Nov 2010 um 08:04 Uhr) Grund: Code-Tags korrigiert
  Mit Zitat antworten Zitat
Antwort Antwort

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:40 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz