Autor Beitrag
FlameDiver
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 104

WIN XP
D6 Pers
BeitragVerfasst: Sa 25.12.04 16:35 
hi wie ihr der überschrift entnehmen könnt wollte ich fragen obs diesen explode befehl auch in delphi gibt. ich braüchte den.

_________________
From Hell and back again
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Sa 25.12.04 16:39 
Ja, hier.

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

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 25.12.04 16:40 
Hallo!

Das geht über eine Stringlist. Du setzt den "Delimiter" der Stringlist auf das entsprechenden Trennzeichen und schreibst Deinen String dann in "DelimitedText". Dann enthält die Stringlist die einzelnen Elemente des Strings.

MfG
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
FlameDiver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 104

WIN XP
D6 Pers
BeitragVerfasst: Sa 25.12.04 16:51 
boa danke für die schnelle hilfe :D

noch eine Frage wie kann ich Einstellen das er beim Delimiter nicht auch Leerzeichen als Trennzeichen nimmt?

_________________
From Hell and back again
FlameDiver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 104

WIN XP
D6 Pers
BeitragVerfasst: Sa 25.12.04 17:31 
erstmal hier ist meine function:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
function filename(path:string):string;
var
list:tstringlist;
z:integer;
begin
list := tstringlist.Create;            //list erschaffen
list.DelimitedText := path;            //sting einfügen
list.Delimiter := '\';                 //delimiter setzen

z := list.Count-1;                     //letztes item definieren
path := list.Strings[z];               //item zuweise
result := path;                        //resultat festlegen
end;


aber ich hab bestimmt was falsch...

ich will einen pfad an den \-zeichen trennen und den letzten davon haben

_________________
From Hell and back again
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Sa 25.12.04 18:09 
FlameDiver hat folgendes geschrieben:
aber ich hab bestimmt was falsch...

Bestimmt? Hast du deinen Sourcecode nicht ausprobiert?

Du solltest noch
ausblenden Delphi-Quelltext
1:
list.free;					

aufrufe.

Gruß
Tino
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 25.12.04 18:12 
Tino hat folgendes geschrieben:
Du solltest noch
ausblenden Delphi-Quelltext
1:
list.free;					

aufrufe.
Und das Ganze vor allem noch einen Speicherschutzblock packen! :mahn: ;-)

//edit: Mal versucht, erst den Delimiter zu setzen und dann erst den Text?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
FlameDiver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 104

WIN XP
D6 Pers
BeitragVerfasst: Sa 25.12.04 18:15 
wann muss ich das den aufrufen? nach den createn?

_________________
From Hell and back again
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Sa 25.12.04 18:18 
Nein, dann wenn du die liste nicht mehr benötigst.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
function filename(path:string):string;
var
list:tstringlist;
z:integer;
begin
  list := tstringlist.Create;            //list erschaffen
  Try  
    list.Delimiter := '\';                 //delimiter setzen
    list.DelimitedText := path;            //sting einfügen

    z := list.Count-1;                     //letztes item definieren
    path := list.Strings[z];               //item zuweise
  Finally
    list.Free;
  End;

  result := path;                        //resultat festlegen
end;
FlameDiver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 104

WIN XP
D6 Pers
BeitragVerfasst: Sa 25.12.04 18:21 
ok :idea:

aber wie mach ich das jetzt das die leerzeichen icht mehr als trennzeichen angesehen werden?

_________________
From Hell and back again
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Sa 25.12.04 18:25 
FlameDiver hat folgendes geschrieben:
aber wie mach ich das jetzt das die leerzeichen icht mehr als trennzeichen angesehen werden?

Wo liegt denn das Problem? Schau dir doch mal meinen Code oben an. Dort wird als Trennzeichen das \-Zeichen genommen und nicht das Leerzeichen.
FlameDiver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 104

WIN XP
D6 Pers
BeitragVerfasst: Sa 25.12.04 18:28 
den versteh ich nicht warum er bei mir die auch am leerzeichen trennt

_________________
From Hell and back again
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 25.12.04 18:34 
du kannst alternativ auch ExtractStrings benutzen :roll:

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Sa 25.12.04 18:34 
Sorry, habe gerade erfahren das die TStringlist auch bei einem Leerzeichen trennt... :-(
FlameDiver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 104

WIN XP
D6 Pers
BeitragVerfasst: Sa 25.12.04 18:39 
ach soein mist :D naja danke für die hilfe... gibts da nicht noch ein anderen typ bei dem man saowas amchen könnte?

oder ich mach einfach erst einen array daraus und denn erstetz ich alle leerzeichen mit tilde zeichen :D

ich hab da auch ne funktion

ausblenden Delphi-Quelltext
1:
2:
3:
for i:=0 to length(text1)-1 do text1[i]:=CHR(0);
Move(edit1.text[1],text1[0],255);
text2 := replace(x,text1);


und

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function replace(zahl: integer; text:array of char):string;
begin
while x<=255 do
begin
buchstabe:=text1[x];
if buchstabe = ' ' then buchstabe := '~';

text2:=text2+buchstabe;
inc(x);
end;
replace := text2;
end;


damit müste das den doch gehen oder? und wenn ich den titel hab mach ich das wieder zurück.

_________________
From Hell and back again
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Sa 25.12.04 18:43 
Was spricht gegen die Funktion die hier gepostet wurde? www.delphi-forum.de/...mp;highlight=explode
FlameDiver Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 104

WIN XP
D6 Pers
BeitragVerfasst: Sa 25.12.04 18:47 
oh die hab ich noch garnicht gesehen. :D nur sonne andere. aber ich finde meine idee auch gut :D

_________________
From Hell and back again