Autor Beitrag
PeeTheBee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

Win 98
D4 Pers
BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 03.11.04 14:41 
ausblenden 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
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: 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. :wink:
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 03.11.04 14:54 
Im Forum dürfte ein Routine namens Suche in: Delphi-Forum, Delphi-Library EXPLODE rumschwirren.
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: 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



BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Mi 03.11.04 15:08 
Oh, stimmt. Hatte hier gekuckt. :)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: 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)? :roll:

Edit:
Zitat:
Oh, stimmt. Hatte hier gekuckt.

k.K. :wink:

Moderiert von user profile iconUdontknow: Beiträge zusammengefasst. :wink:
Danzig.Bln
Hält's aus hier
Beiträge: 8



BeitragVerfasst: 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
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Mi 12.01.05 17:29 
1. Neue Frage -> Neuer Thread..
2. :shock: was soll das bedeuten?? strichwort? nie gehört... oO mir is deine Frage leider etwas rätselhaft...

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 12.01.05 17:31 
Hallo Danzig.Bln :welcome:
JayEff hat recht.
Mach bitte eine neues Topic auf und stelle deine Frage bitte etwas verständlicher.