Autor |
Beitrag |
PeeTheBee
Beiträge: 38
Win 98
D4 Pers
|
Verfasst: Mi 03.11.04 14:18
Hallo Leute!
Ich bin auf der Suche nach einer Funktion, die wie folgt aufgebaut sein soll:
function strings_trennen(quellstring, trennzeichen: string; teilnummer: Integer): string;
Möglichst sollte sie auch mit Mehrzeichen-Trennzeichen (z.B. "<>") funktionieren.
Ein Beispiel: strings_trennen('Andreas isst, was er will', ', ', 2) soll "was er will" ergeben. Ich hoffe ihr versteht das, und
vielen Dank für eure Bemühungen, Peter
|
|
jaenicke
Beiträge: 19285
Erhaltene Danke: 1743
W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Mi 03.11.04 14:41
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
| function strings_trennen(quellstring, trennzeichen: string; teilnummer: Integer): string; var aktuellTeil: Integer; begin aktuellTeil:=1; while aktuellTeil < teilnummer do if Pos(trennzeichen,quellstring) > 0 then Delete(quellstring,1,Pos(trennzeichen,quellstring)+Length(quellstring)-1) else Break; if aktuellTeil = teilnummer then Result:=Copy(quellstring,1,Pos(trennzeichen,quellstring)-1) else Result:=''; end; |
Hoffe das geht.
|
|
Udontknow
Beiträge: 2596
Win7
D2006 WIN32, .NET (C#)
|
Verfasst: Mi 03.11.04 14:43
Hallo!
Die Unit JCLStrUtils Von den Jedi-Leuten beeinhaltet die Routine ExtractWord, die genau das macht.
Cu,
Udontknow
|
|
jaenicke
Beiträge: 19285
Erhaltene Danke: 1743
W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Mi 03.11.04 14:53
Ja, ich weiß und eine meiner Tool-Units hat auch so eine Funktion, aber ich wollte jetzt nicht irgendwohin verweisen.
|
|
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1
|
Verfasst: Mi 03.11.04 14:54
Im Forum dürfte ein Routine namens EXPLODE rumschwirren.
|
|
Udontknow
Beiträge: 2596
Win7
D2006 WIN32, .NET (C#)
|
Verfasst: Mi 03.11.04 14:59
Explode kann aber imho nur nach einem Zeichen trennen, nicht nach Zeichenketten als Terminatorsymbol.
Cu,
Udontknow
|
|
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1
|
Verfasst: Mi 03.11.04 15:02
www.delphi-forum.de/...mp;highlight=explode
Separator ist zumindest als String deklariert. Ausprobiert habe ich es aber noch nicht.
|
|
Udontknow
Beiträge: 2596
Win7
D2006 WIN32, .NET (C#)
|
Verfasst: Mi 03.11.04 15:08
Oh, stimmt. Hatte hier gekuckt.
|
|
jaenicke
Beiträge: 19285
Erhaltene Danke: 1743
W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Mi 03.11.04 15:09
Udontknow hat folgendes geschrieben: | Explode kann aber imho nur nach einem Zeichen trennen, nicht nach Zeichenketten als Terminatorsymbol. |
Wofür wäre dann darin SepLen, die die Länge des Separators bekommt (in Zeile 24)?
Edit: Zitat: | Oh, stimmt. Hatte hier gekuckt. |
k.K.
Moderiert von Udontknow: Beiträge zusammengefasst.
|
|
Danzig.Bln
Hält's aus hier
Beiträge: 8
|
Verfasst: Mi 12.01.05 17:17
hallo ,
ich bin neu hier ...
kann mir jemand sagen , wie ich es schaffe , dass ich ein "suchwort " in edit 1.text in ein " strichwort (===) " ausgeben kann ?
|
|
JayEff
Beiträge: 2971
Windows Vista Ultimate
D7 Enterprise
|
Verfasst: Mi 12.01.05 17:29
1. Neue Frage -> Neuer Thread..
2. was soll das bedeuten?? strichwort? nie gehört... oO mir is deine Frage leider etwas rätselhaft...
_________________ >+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
|
|
jasocul
Beiträge: 6388
Erhaltene Danke: 146
Windows 7 + Windows 10
Sydney Prof + CE
|
Verfasst: Mi 12.01.05 17:31
Hallo Danzig.Bln
JayEff hat recht.
Mach bitte eine neues Topic auf und stelle deine Frage bitte etwas verständlicher.
|
|