Splitting CSVs in Actionscript (the Excel way)

Ever needed to split CVSs in Actionscript? Tried using String.split()?

Using a CSV from Excel I had the problem that String.split() does not support to use the delimiter inside of the value fields (Excel puts double quotes around fields that contain the delimiter).

After playing with some regular expressions I made a textSplit() method that let’s you specify such a quoting character (I called it textDelimiter). Here it is (helpers included):

And here you can find the test case I used: