Autor Beitrag
andre.maus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28

winXP
Delphi 7
BeitragVerfasst: Mo 12.07.04 12:45 
Hallo,

ich habe eine Stringlist mit Text, der viele Leerzeichen enthält.
Ich will nun alle Leerzeichen mit Kommas ersetzen.

aus:

hallo was geht
denn heute abend

soll werden:

hallo,was,geht
denn,heute,abend

Kann mir jemand weiterhelfen?

Gruß,
Andre
inselberg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 458



BeitragVerfasst: Mo 12.07.04 12:57 
brauchst du das für CommaText ?
weil dann kannst du das auch über DelimitedText und Delimiter lösen ...

ansonsten über jclstrings strreplace oder ganz altmod.

ausblenden Quelltext
1:
2:
while pos(' ',listbox1.Items.Text) > 0 do 
 listbox1.Items.Text[pos(' ',listbox1.Items.Text)] := ',';

_________________
hans bist du das ?
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mo 12.07.04 13:04 
ausblenden Delphi-Quelltext
1:
with ListBox1.Items do StringReplace(Text,' ',',',[rfReplaceAll]);					

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mo 12.07.04 15:14 
maxk hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
with ListBox1.Items do StringReplace(Text,' ',',',[rfReplaceAll]);					


wie war das? "Es wird nicht funktionieren" :)

StringReplace ist eine Funktion, ergo:
ausblenden Delphi-Quelltext
1:
2:
with ListBox1.Items do 
  Text:= StringReplace(Text,' ',',',[rfReplaceAll]);

_________________
"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)
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: Mo 12.07.04 19:56 
user defined imageOh verzeiht, da habe ich wohl einen Fehler gemachtuser defined image

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mo 19.07.04 14:48 
maxk hat folgendes geschrieben:
user defined imageOh verzeiht, da habe ich wohl einen Fehler gemachtuser defined image


dir sei verziehen user defined image

_________________
"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)