CSV String to integers

I have a String called data. This contains something like the following 255,13,0
These are RGB values for a light. In order to use these with the library for the light i want to use i need to convert them into separate integers eg:
int r = 255;
int g = 13;
int b = 0;

so in short how do i convert csv into integers
note this could also be into an array rather than 3 different int's

First if your are using String with a capital S stop it and use just char arrays

Once you have a char array, use strtok with a comma as delimiter and use atoi() to parse the integers

Have a look at the parse example in Serial Input Basics. It uses strtok() and atoi()

...R