I have a requirement to convert CSV values entered by user into a Javascript array (of arrays).
No server roundtrip should be made and it should be totally offline/client-side.
If possible, the script should be browser independent.
I have seen a previous post http://www.thescripts.com/forum/thread146456.html but could not find any code level hints.
I know I could use split function and write my own parsing code. But if it is a single line I know the logic can be something like the below, but what if there is a multi-line CSV data in a TextArea?
Expand|Select|Wrap|Line Numbers
- function jsSplitString(stringToSplit){
- var splitArray = stringToSplit.split(",");
- for (var i = 0; i < splitArray.length; i++){
- // add to array
- }
- }