Hat mich doch noch der Ehrgeiz gepackt und da PHP vermutlich nicht so gefragt ist...
Hier meine Lösung:
Code:
D pos s 10i 0 inz(0)
D ix s 10i 0 inz(0)
D Ara s 50a varying dim(99)
D src s 5000a inz('"""Text""";Text;1;1,98;"3;4";+
D "A;B;""C"')
/free
src = %trimr(src) + ';'; // set end mark
dow src > *blanks;
if %subst(src:1:1) = '"' and %subst(src:1:2) <> '""';
pos = %scan('";':src);
if %subst(src:pos+1:2) = '""';
dou %subst(src:pos+1:2) <> '""';
pos = %scan('";':src:pos+1);
enddo;
endif;
pos += 1;
else;
pos = %scan(';':src);
endif;
if pos > 1;
ix += 1;
ara(ix) = %trimr(%subst(src:1:pos-1));
if %subst(ara(ix):1:1) = '"'; // cleanup
ara(ix) = %replace('':Ara(ix):1:1);
ara(ix) = %replace('':Ara(ix):%len(ara(ix)):1);
endif;
src = %subst(src:pos+1); // shift
endif;
enddo;
Ara = %scanrpl('""':'"':Ara); // ab V7R1
/end-free
Erstaunlicherweise funktioniert sie auch ;-)
Alle Angaben ohne Gewähr (wie eine Lottopanne lehrt)
Bookmarks