cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Getting values from comma separated stri
Getting values from comma separated string?
Jan 30, 2012 at 1:49am UTC
hopesfall
(179)
I have a string which has values separated by commas and I need to retrieve one value at a time. The string looks like "1,2,3,4,5,6,7," and I want to get just the number, not the comma or any white space.
Any ideas?
Thanks
Jan 30, 2012 at 1:51am UTC
Zhuge
(4664)
You could use string::find() to find the first comma, then substr() to get a substring up to that point. Read/remove it, then repeat.
Topic archived. No new replies allowed.