Thema: Delphi String und Char

Einzelnen Beitrag anzeigen

Benutzerbild von BlackJack
BlackJack

Registriert seit: 2. Jul 2005
Ort: Coesfeld
246 Beiträge
 
Delphi 2005 Personal
 
#9

Re: String und Char

  Alt 5. Jul 2005, 10:50
Zitat von Catbytes:
Das Problem ist zwar schon gelöst, aber Dein Code wird auch sagen "Das waren alle Vokale!", wenn ich

s := 'AAAAAAAAAAAAAAAAAA'; tippe
um das zu umgehen, musst du nur die if-bedingung anpassen:

Delphi-Quellcode:
      if c in ['A','E','I','O','U'] then
        begin
        inc(v);
        Remove(c, v); // <==
        end;
      if v = 5 then
        begin
          showMessage('Das waren alle Vokale!');
          abort;
        end;
edit: vergesst was ich da gerade geschrieben habe, man müsste natürlich eine variable des types set of char deklarieren, die zuerst alle vokale enthält und woraus dann die vokale entfehrnt werden...
See my shadow changing, stretching up and over me.
Soften this old armor. Hoping I can clear the way
By stepping through my shadow, coming out the other side.
Step into the shadow. Forty six and two are just ahead of me.
  Mit Zitat antworten Zitat