seperating a string
I have a string that includes numbers and letters and I want to be able to seperate the string into parts. An example of the string looks like this FAP834E. I want to seperate it so that the first letter is seperate (F), the second and third are together (AP), the fourth and fifth are together (83), the sixth is seperate (4) and the last is seperate (E).
Please letme know if you can help me
Is it always that same sequence?
Create variables for each section of the string you want saved, then iterate through string an copy the corresponding values to the variables.
Are you using std::string or a char array (pointer)?
For a std::string you can use substr
std::string myStr = "FAP834E";
int start = 0;
std::string first = myStr.subStr(start, 1); //F
start += 1;
std::string second = myStr.subStr(start, 2); //AP
start += 2;