Noch ein Tipp: Als ich splitStringToArray() vorschlug, habe ich das getan, als Vergleich:
- in PB gibt's das nicht (selber coden)
- in Perl gibt's sogar einen nativen Befehl dafür
Hm also die SplitToArray nutzt ja den Perl Split() ^^
Das es dircket in PB kürzer geht is klar sollen ja nur Beispiele sein was man so machen kann.
So und nun noch nen Bsp. mit splice()
neu in der PerlTools_Include.pbi
Code: Alles auswählen
Procedure plSplice(plHandle.l, MyArray.s(1), splStart.l, splStop.l, String.s = "")
Protected buffer.s = Space(BufferSize)
plEval(plHandle, "my @WorkArray ;", 0)
For x = 0 To PeekL(@MyArray.s() - 8) - 1
plEval(plHandle, "$WorkArray["+Str(x)+"] = '" + MyArray.s(x) + "';", 0)
Next
If String <> ""
plEval(plHandle, "splice(@WorkArray,"+Str(splStart)+","+Str(splStop)+","+String+");", 0)
Else
plEval(plHandle, "splice(@WorkArray,"+Str(splStart)+","+Str(splStop)+");", 0)
EndIf
Rows.l = Val(plEval(plHandle, "@WorkArray;"))
ReDim MyArray.s(Rows)
For x = 0 To Rows
MyArray.s(x) = plEval(plHandle, "@WorkArray["+Str(x)+"];")
Next
EndProcedure
und in der example.pl
Code: Alles auswählen
For x = 0 To PeekL(@String() - 8) - 1
Debug String(x)
Next
Debug Space(1)
plSplice(plHandle, String(), 1, 0, "Neu1")
plSplice(plHandle, String(), 4, 0, "Neu2")
plSplice(plHandle, String(), 5, 1, "der_ist_ersetzt")
For x = 0 To PeekL(@String() - 8) - 1
Debug String(x)
Next