An odd one; I thought I’d make a quick and dirty NEMA parser for my Adafruit GPS. I’m capturing the NEMA strings just fine. Alas, things fall apart after that.
Consider this example:
$GPRMC,200023.086,0,0,M,M,*45
This should parse out to:
//0 $GPRMC, type //1 200123.086, UTC time //2 V, V (void) or A (active) //3 , lat (missing if void) //4 , lat dir (missing if void) //5 , lon (missing if void) //6 , lon dir (missing if void) //7 0.00, speed (knots) //8 0.00, compass direction //9 190115, date (ddmmyy) //10 , magnetic variation (missing if void) //11 , magnetic variation direction (missing if void) //12 N*4D checksum
But if I use:
local nemaArray = split(gpsLine,",");
…I get a len() of seven instead of the expected thirteen; when I iterate through, lat, lon, etc. are completely missing.
I tried searching the documentation, but I’m probably using the wrong terminology. Sorry!
In short: how do I split a csv array to preserve null values?