Autor Beitrag
TheUnknown
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 334



BeitragVerfasst: Mi 15.10.03 11:37 
...


Zuletzt bearbeitet von TheUnknown am Do 22.08.13 08:18, insgesamt 1-mal bearbeitet
JoelH
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 806
Erhaltene Danke: 17

Win10
Delphi Alexandria 11.2 Patch 1
BeitragVerfasst: Mi 15.10.03 12:17 
Titel: hmm,
damit kannste das machen www.delphi-forum.de/...ic.php?p=45780#45780

einfach die Anzahl der Elemente des Arrays abzaehlen.

_________________
mfg. Joel
Sven
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 314


D6 Ent, K3 Pro (patched)
BeitragVerfasst: Mi 15.10.03 12:25 
Ich habe mal eine ähnlich Frage gehabt und diesen Code als Antowrt bekommen:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
procedure TMDIChild.CalcWords;
  var Anzahl, i : integer;
      s1        : String;
      RTF       : TStringList;
begin
  RTF := TStringList.Create;
  try
    RTF.Text := Editor.Text;
    Anzahl := 0;
    // An jede Zeile ein 'blank' anhängen,
    // da sonst das letztes Wort nicht gezählt wird
    for i := 0 to RTF.Count-1 do begin
      // Prüfen, ob das letzte Zeichen ein Bindestrich ist
      s1 := RTF[i];
      if length(s1) > 0 then begin
        if s1[length(s1)] <> '-' then begin
          // wenn nicht, dann ein Leerzeichen ans Ende setzen
          RTF[i] := RTF[i]+' ';
        end;
      end;
    end;
    // Los gehts mit dem Zählen.
    s1 := RTF.Text;
    // Solange vorne löschen, bis kein Leerzeichen mehr drin ist}
    while Pos(' ',s1) > 0 do begin // Falls noch ein Leerzeichen vorhanden
      Inc(Anzahl);                 // Zähler eins hochsetzen
      Delete(s1,1,Pos(' ',s1));    // und bis zu diesem Leerzeichen vorne löschen
      s1 := TrimLeft(s1);          // Eventuell doppelte Leerzeichen und Steuerzeichen
                                   // vorne entfernen
    end;
    ShowMessage(Format('Es wurden %d Wörter gezählt', [Anzahl]))
  finally
    RTF.Free
  end
end;


Ich hoffe es hilft :D

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.

_________________
MDK 9.1, Kernel 2.4.21, KDE 3.1 Kylix 3 Pro (patched), nutze aber auch Windows
TheUnknown Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 334



BeitragVerfasst: Mi 15.10.03 20:08 
...


Zuletzt bearbeitet von TheUnknown am Do 22.08.13 08:18, insgesamt 1-mal bearbeitet
TheUnknown Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 334



BeitragVerfasst: Mo 20.10.03 16:54 
...
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.