Search:
Forum
Beginners
split a string at first whitespace
split a string at first whitespace
Dec 15, 2008 at 1:03am UTC
tyky9808
(32)
Hi can anyone help. I appreciate any help I can get. How do you split a string that you are reading from a file at the first whitespace? Do you use substring to do that?
Dec 15, 2008 at 1:30am UTC
Zhuge
(4664)
Yes. Use find() to find the space and substr() to get the sections.
Dec 15, 2008 at 5:16am UTC
anders43
(125)
while
you are reading from the file?
in that case you can use getline() with ' ' as a delimiter
Dec 15, 2008 at 12:49pm UTC
Bazzy
(6281)
if you use
file >> string
it should break when a whitespace is found
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs