Autor Beitrag
Terminator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34


D6 Prof
BeitragVerfasst: Mo 12.12.05 13:17 
Hallo,
ich habe eine StringListe die ich sotieren möchte.
nun möchte ich wissen ob in der liste integer, float oder datumswerte sind.

Klar momentan sind ja alles strings, da liegt auch das problem wie bekomme ich heraus was für "typen" hinter meiner stringlist sind.

_________________
Man muss nicht alles glauben, was stimmt!
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Mo 12.12.05 13:22 
Testen :wink:

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 12.12.05 13:25 
Moin!

Da bleibt dir nix anderes übrig, als die Strings versuchsweise umzuwandeln, z.B. mit StrToFloat/Def oder StrToInt/Def... :wink:

cu
Narses
chrisw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 439
Erhaltene Danke: 3

W2K
D7
BeitragVerfasst: Mo 12.12.05 13:29 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
function IsIntegerRealOrDate (s:String) : Integer;
begin
  Result := 0;
  try
    StrToInt(S);
    Result := 1;
    exit
  except
  end;
  try
    StrToFloat(S);
    Result := 2;
    exit;
  except
  end;
  try
    StrToDate(S);
    Result := 3;
  except
  end;
end;

_________________
Man sollte keine Dummheit zweimal begehen, die Auswahl ist schließlich groß genug.
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Mo 12.12.05 14:23 
Hilfe!!!
Einfach durchparsen, ob es einen decimalseperator gibt oder wie beim Datum zwei davon.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 12.12.05 16:09 
Hallo,

DateSeparator 2x gefunden, dann ist z.B der '50.12.2005' ein Datum :gruebel:

'1.000.000' könnte ein Integerwert mit Tausender-Trennzeichen darstellen, der würde wiederum mit der Funktion von user profile iconchrisw nicht gefunden.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Mo 12.12.05 16:25 
Ich persönlich würd in ner Zahl keine Tausenderzeichen setzen.
Außerdem sind die immer 3 Stellen auseinander, während das beim Datum nicht so ist.