Greetings
I wrote a program where it reads from a textfile until it gets to a certain line which contains one of twelve possible strings. Four of those strings have a comma in it. This comma annoys me because I want to write down the exact line into a csv file in the next step. If I tell the programm to write down the read line my string will not appear in one, but two cells in excel, which is understandable as I work with
comma-seperated-values...
I had two ideas: one was to delete the comma out of my string (this would be fine for me), but DelChars(Zeile,','); wouldn't work for me (Zeile is the name of my string, the line i read from my textfile)... I don't know why...
then I tried the following:
repeat
readln(t2,Zeile);
until
(Zeile = '4-4-2 Raute') or
(Zeile = '4-4-2 Flach') or
(Zeile = '4-4-2 Flügel') or
(Zeile = '4-3-3 Halb offensiv, Konter') or //here
(Zeile = '4-3-3 Offensiv') or
(Zeile = '4-2-3-1 Kontrollierte Offensive') or
(Zeile = '4-2-3-1 Defensiv, Konter') or //here
(Zeile = '4-1-4-1 Defensiv, Konter') or //here
(Zeile = '3-5-2 Dreierkette, Kompaktes Mittelfeld') or //here
(Zeile = '3-4-3 Dreierkette (offensiv)') or
(Zeile = '4-1-5-0 Falsche Neun') or
(Zeile = '4-2-4-0 Falsche Neun'); //this were the twelve possible strings. This works fine so far... if I try to writeln(csv,Zeile) then my string will be in two cells when there is a comma in my string...
if Zeile = '4-4-2 Raute' then writeln(csv,'4-4-2 Raute')
else if Zeile = '4-4-2 Flach' then writeln(csv,'4-4-2 Flach')
else if Zeile = '4-4-2 Flügel' then writeln(csv,'4-4-2 Flügel')
else if Zeile = '4-3-3 Halb offensiv, Konter' then writeln(csv,'4-3-3 Halb offensiv + Konter') //here
else if Zeile = '4-3-3 Offensiv' then writeln(csv,'4-3-3 Offensiv')
else if Zeile = '4-2-3-1 Kontrollierte Offensive' then writeln(csv,'4-2-3-1 Kontrollierte Offensive')
else if Zeile = '4-2-3-1 Defensiv, Konter' then writeln(csv,'4-2-3-1 Defensiv + Konter') //here
else if Zeile = '4-1-4-1 Defensiv, Konter' then writeln(csv,'4-1-4-1 Defensiv + Konter') //here
else if Zeile = '3-5-2 Dreierkette, Kompaktes Mittelfeld' then writeln(csv,'3-5-2 Dreierkette + Kompaktes Mittelfeld') //here
else if Zeile = '3-4-3 Dreierkette (offensiv)' then writeln(csv,'3-4-3 Dreierkette (offensiv)')
else if Zeile = '4-1-5-0 Falsche Neun' then writeln(csv,'4-1-5-0 Falsche Neun')
else if Zeile = '4-2-4-0 Falsche Neun' then writeln(csv,'4-2-4-0 Falsche Neun')
else writeln(csv,'Aufstellung nicht erkannt');
So now I didnt want to writeln(csv,Zeile); and instead told the program to write an individual string (without commas) for each string... strangely this doesn't work, I still get the strings with commas in two cells as if I still used writeln(csv,Zeile);...
Does anyone have an idea what I could do?
And could someone explain me why DelChars doesn't work here in the first place (or how I could make it work)?
Thanks for your attention
I’m looking forward to your reply