seperate string by comma's

I would like to seperate a string value of multiple sub strings into an array.
The string value is i.e.

(1,3,5,2018,13,26,33);

I would like to convert these into an array or even into seperate new variables.
So far I haven't got anything working.

Any advice?

Have you looked at the charat function?

That together with compareto and substring, and you should be able to use a loop to look for the commas, extract the characters in between and then populate your array. The following is not code, but...

//do one loop just to count commas
For i = 1 to length of string
If char at “i” is a comma (compareto), commas = commas +1

//set array to number of commas to hold comma positions
//set second array, one element bigger, to hold data (last item has no comma)

Then for i = 1 to length of string (again)
Record comma positions in array 1
Use substring to extract data between commas and populate second array.

The parse example in Serial Input Basics should give you the general idea.

...R

Use strtok :slight_smile:

Danois90:
Use strtok :slight_smile:

That's how my parse example does it.

...R