|
-
January 29th, 2010, 07:30 AM
#11
Re: splitting a string
 Originally Posted by farooq124in
I tried a sample code
Good to see that you posted code in code tags, but you should also indent the code properly and tell us how does it not work.
You might want to simplify things: write a program that given a string literal with the kind of input you expect, parses that string correctly.
 Originally Posted by Joeman
Just convert '$' to ' '. after that place your string into a stringstream object. use the operator >> to extract each token placing them into a stl container. this is the simplest form.
However, a caveat with this method is that it may give you incorrect results if the original string may contain whitespace.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|