I have this string d ="3 J JD, K" and i want to split the string to individual string. I have this code which eliminates the comma but doesn't split the string into individual string.
Since your delimiter here is spaces, all you have to do is replace the comma with a space, then use a std::istringstream to extract each token into a new string.
This will not work because strtok takes a char* as a parameter, and not a std::string. Mixing C string functions with std::string is generally a bad idea.