Thema: Delphi Trim funktion

Einzelnen Beitrag anzeigen

1ceman

Registriert seit: 16. Dez 2005
Ort: Odenthal
134 Beiträge
 
Delphi 6 Personal
 
#1

Trim funktion

  Alt 28. Feb 2006, 15:31
Ich hab ne kleine funktion für ein projekt geschrieben, die Sonderzeichen und Umlaute aus einem Memo-Feld ersetzt:

Delphi-Quellcode:
function TForm1.trimmen(M:TMemo):TMemo;
var y,x : integer;
    code : string;
begin
for y := 0 to M.Lines.count-1
do begin
          code := '';
          for x:= 1 to length(M.Lines[y])
          do if Upcase(M.Lines[y][x]) in['A'..'Z']
             then code := code + Upcase(M.Lines[y][x])
             else case Upcase(M.Lines[y][x]) of
                  'Ä': code := code + 'AE';
                  'Ö': code := code + 'OE';
                  'Ü': code := code + 'UE';
                  'ß': code := code + 'SS';
                  else
                       code := code + ' ';
                  end;
          result.Lines.Add(code);
   end;
end;
FehlerMeldung:
---------------------------
Debugger Exception Notification
---------------------------
Project Project1_morsen.exe raised exception class EAccessViolation with message 'Access violation at address 00457A49 in module 'Project1_morsen.exe'. Read of address 00000220'. Process stopped. Use Step or Run to continue.
---------------------------
---------------------------
Dieser Fehler kommt in folgender Zeile:
result.Lines.Add(code);
Roman
  Mit Zitat antworten Zitat