Autor Beitrag
majolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Do 29.05.03 18:10 
Hallo,

ich habe ein kleines Problem ich habe eine ID nach folgendem Schemata:

1S12345Z123548

So nun möchte ich gerne die Zeichen 123548 an einen Integer übergeben von mir aus i1. Also den Teil bis z. So nun die Zahlen zwischen S und Z also 12345 an i2. Die Zahlen zwischen S und Z bzw nach Z sollen beliebig viele sein. Ist es möglich so etwas zu realisieren? CodeBSp wäre nicht schlecht. Habe schon experimentiert klappt aber irgendwie nicht.
Vielen Dank im vorraus

Gruss
majolo
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Do 29.05.03 18:16 
Wenn Du mit Pos die Position von "S" und "Z" ausfindig machst, solltest Du mit Copy den String dazwischen bekommen können. Den in Integer umwandeln, fertig. Und mit der Position von Z und der Länge des Strings kannst Du per Copy auch den letzten Teil des Strings extrahieren und in Integer umwandeln.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Phantom1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 390



BeitragVerfasst: Do 29.05.03 18:28 
so zum beispiel:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
Procedure GetInts(s1: String; Var wert1, wert2: Integer);
var 
  a, b: integer;
Begin
  a:=Pos('S', s1);
  b:=Pos('Z', s1);
  wert1:=StrToInt(Copy(s1, a+1, b-1-a));
  wert2:=StrToInt(Copy(s1, b+1, Length(s1)-b));
End;
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Do 29.05.03 19:26 
Okay vielen Dank hat geklappt.