Is there a function in C++ that will split a char array delimited by a specific character?
-
If i for example have this string: "192,168,135,97,51,156" is it possible to split that into 6 integers containing the values delimited by the comma? thanks all :)
-
If i for example have this string: "192,168,135,97,51,156" is it possible to split that into 6 integers containing the values delimited by the comma? thanks all :)
strtok should do the thing ... also, could do it by hand with CString ( and/or std::string ) Max.
-
If i for example have this string: "192,168,135,97,51,156" is it possible to split that into 6 integers containing the values delimited by the comma? thanks all :)
-
strtok should do the thing ... also, could do it by hand with CString ( and/or std::string ) Max.
strtok is the one, but be careful if you have "blank" tokens e.g. "1,2,3,,5". strtok will say there are 4 values here rather than 5 (4 numbers and one blank token). Dave.
-
If i for example have this string: "192,168,135,97,51,156" is it possible to split that into 6 integers containing the values delimited by the comma? thanks all :)
Be aware that strtok is destructive to the original string