Explode in arduino

// String data = (const char*) Ethernet::buffer + off;
String data = "aa | 00: 03 | 2.7 | 1.2 | 4 | 2.2 | 3.2 | 2.2 | 2.7 |";

I needed to convert this data individually into different String abc ... String def names. It's basically an explode, but I need to throw it in different strings with my own names.
Thank you very much for the help.

Well - the good news is that your values are consistently delimited by 'pipe' characters '|'
Now you can read up on the strtok() function to see how we pull character arrays apart into fields we can use.


Good luck.

Do not use String, use a c string (null terminated fixed length char array)

String is evil in Arduino - it causes weird memory issues. There are cases where String is okay, but by the time you have the depth of understanding to know what these are, you'd understand how to use normal c-strings (null terminated character arrays).

strtok is a very powerful function; you will need to read the documentation on it, and some examples, several times to get the hang of it though (at least I did).

The parse example in Serial Input Basics illustrates the use of strtok()