Hallo zusammen,
ich habe - neben meinem anderen aktuellen Thread folgendes Problem:
Ich lese eine Stückliste ein, die im CSV-Format vorliegt, separiert durch Strichpunkte (das ist Vorgabe vom Kunden).
Leider gibt es in der Stückliste eine Textspalte, in der ab und zu auch ein Strichpunkt vorkommt.
Da ich im Skript mittels StringSplit die eingelesenen CSV-Zeilen in Spalten splitte bekomm ich nun natürlich jedesmal, wenn in der Textspalte ein ";" vorkommt das Problem, dass eine neue Spalte erkannt wird, obwohl es sich hier ja nicht um eine neue Spalte handelt.
Bisher hab ichs so gelöst, dass ich bei der ersten CSV-Zeile, die ich
einlese die Anzahl der Spalten in eine Variable schreibe (weil in der
ersten Zeile garantiert noch kein Strichpunkt im Text vorkommt) und dann
beim Einlesen jeder neuen Zeile vergleiche, ob die Anzahl der durch die
StringSplit-Funktion ermittelten Spalten mit dem Initialisierungswert übereinstimmt.
Ist
dies nicht der Fall werden ab der Spalte, die sich vor der Textspalte befindet soviele Strichpunkte weggekürzt und der
String neu aufgebaut, bis ich die gleiche Anzahl an Spalten habe. Das geht aber auch nur, weil ich nur EINE Textspalte habe
Problem: Die Stückliste soll in naher Zukunft noch eine zweite Textspalte enthalten in der auch wieder Strichpunkte vorkommen können.
Wie würdet ihr das Problem denn lösen?
Viele Grüße
Daniel