Autor Beitrag
rizor
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 17:17 
Hi,

wie kann eine Ausgabe auswerten?
Also es wird etwas in ein Edit eingegeben und er soll erkennen was eingegeben wurde und berechnen.

Beispiel:
Im Edit steht "Ah Ac 10s"

Wie kann ich jetzt alles auswerten, also dass er Ah als einzelnes ansieht und Ac und 10s genau so?

Danke im voraus.

rizor
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.09.06 17:20 
Du könntest den String anhand des Trennzeiches (hier ' ') zerlegen.

_________________
Markus Kinzler.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 17:22 
Wie soll das funktionieren?
Kann ich mir nicht so recht vorstellen
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.09.06 17:25 
Entweder mit PosEx oder mit einer StringListe (.Delimiter, .DelimitedText);

_________________
Markus Kinzler.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 17:28 
So gut kenne ich mich mit Delphi nicht aus.
Ich weiß also nicht wie ich das schreiben soll.
Kannst du mir da vllt mal ein Beispiel machen?

Danke.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.09.06 17:31 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var
  sl: Strings;
...
begin
    sl := TStringList.Create;
    sl.Delimiter:= ' ';
    sl.DelimitedText := Edit.Text;

Der 1. Wert Steht dann in sl.Strings[0]

_________________
Markus Kinzler.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 17:35 
Danke.
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 18:05 
Wie kann ich jetzt noch erkenne, in wievielen arrays er die sachen gespeichert hat?
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 24.09.06 18:08 
user profile iconrizor hat folgendes geschrieben:
Wie kann ich jetzt noch erkenne, in wievielen arrays er die sachen gespeichert hat?

Er benutzt direkt keine Arrays. Du hast eine Stringlist, diese kapselt gewissermaßen ein String-Array. Wenn, dann hast du nur ein Array! Du willst bestimmt die Anzahl der Bestandteile haben? Das geht mit sl.count.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: So 24.09.06 18:09 
er speichert in EINEM Array, falls du wissen willst wieviele ELEMENTE im Array belegt sind : length(dein_array);

Edit : user profile iconMarco D. hat natürlich recht...
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 18:16 
Mir wird gesagt, dass strings ein unbekannter bezeichner ist.
Wie kann ich das beheben?
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 24.09.06 18:21 
user profile iconrizor hat folgendes geschrieben:
Mir wird gesagt, dass strings ein unbekannter bezeichner ist.
Wie kann ich das beheben?

Mir ist gerade die Glaskugel heruntergefallen und ich kann nicht mehr hellsehen. :motz:
:zwinker:
Poste mal bitte den Quellcode. ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 18:24 
ausblenden 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:
var
  h,b,sh,sb: Strings;
var i:integer;
begin
    i:=0;
    h:=TStringList.Create;
    h.Delimiter:= ' ';
    h.DelimitedText := Ehand.Text;
    while i<>h.count do
      begin
        sh:=TStringList.Create;
        sh.Delimiter:= '';
        sh.DelimitedText := h.Strings[i];
        i:=i+1;
      end;

    i:=0;
    b:=TStringList.Create;
    b.Delimiter:= ' ';
    b.DelimitedText := board.Text;
    while i<>b.count do
      begin
        sb:=TStringList.Create;
        sb.Delimiter:= '';
        sb.DelimitedText := b.Strings[i];
        i:=i+1;
      end;
end;


und da erkennt er die strings net.
also die deklaration

Moderiert von user profile iconChristian S.: Quote- durch Delphi-Tags ersetzt


Zuletzt bearbeitet von rizor am So 24.09.06 18:26, insgesamt 1-mal bearbeitet
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 24.09.06 18:25 
Es muss ja auch nur 'string' heißen.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 18:27 
hmm...
jetzt heißt es, das tstringlist inkompatibel zu string ist.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 24.09.06 18:30 
user profile iconrizor hat folgendes geschrieben:
hmm...
jetzt heißt es, das tstringlist inkompatibel zu string ist.

Ich hatte mir den restl. Code nicht angeschaut. Eine Stringlist ist ja auch kein String und umgekehrt. Schreib bei der Deklaration statt string einfach TStringlist hin.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.09.06 18:36 
Zitat:
Es muss ja auch nur 'string' heißen.

Nein TStrings
es reicht aber eine Instanz, welche du wiederverwenden kannst ( Einfach Neusetzten von .DelimitedText)

_________________
Markus Kinzler.


Zuletzt bearbeitet von mkinzler am So 24.09.06 18:37, insgesamt 1-mal bearbeitet
rizor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 209

WIN XP
Delphi 2005 PE, Visual C++
BeitragVerfasst: So 24.09.06 18:37 
Danke.
Jetzt geht es.