After reading a .csv file and saving it to an array, I encountered the following array structure:
var data = [["abc;def"],["ghi;jkl"], ...]
The strings within the nested arrays are separated by semicolons. In order to work with this data more effectively, I need to split these strings at the semicolons to achieve the desired structure:
var data = [["abc", "def"], ["ghi", "jkl"]].
While I could loop through the array and manually split each string, there might be a better way to accomplish this task. I attempted the following approach:
var dataFormatted = data.forEach((row :Array<String>)=> {
return row[0].split(";");
});
Unfortunately, executing this code results in "dataFormatted" being undefined. Is there a solution to achieve my goal using this method?