Parsing in Mbed

21 Mar 2018

Hello,

I want to build a xy-plotter. I want to use HPGL code. Is there a possibility to parse a string in Mbed? I want to parse: IN;FS1;VS1;SP1;PU0,6078;PD5291,6078,5291,0,0,0,0,6078;SP0;PU0,0;IN; and use ";" as a delimiter. Does anybody have a clue?

21 Mar 2018

Hi!

You should have access to pretty much all of the C/C++ standard libraries so you can either use strtok for C strings or a combination of std::string::find and std::string::substr for CPP std::strings.

https://stackoverflow.com/questions/3889992/how-does-strtok-split-the-string-into-tokens-in-c https://stackoverflow.com/questions/14265581/parse-split-a-string-in-c-using-string-delimiter-standard-c/14266139

Hope this helps, -Michael