Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: string spli...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 9559 of 9807
Post > Topic >>

Re: string splitting

by "Hakusa@[EMAIL PROTECTED] " <Hakusa@[EMAIL PROTECTED] > Apr 29, 2008 at 05:38 PM

Have you considered a stringstream?
String streams inherit from istream so for the arguments that are
space separated, you could use the simple >> operator. The
disadvantage being that there's no string::find() to find the dot
between two dot separated inputs, but you could write your own.
stringstream::getline() could help you after you know where to
separate them.

Or, by using a string, there's string::find(). You'd have to work out
how to find the last dot for your sequence of dots, though.

Or, you could always use a combination of strings and a stringstream.
Use the stringstream to put all the space separated stuff into
separate strings, then use the string::find_last_of() to easily
separate everything into its final arguments.

Lots of fun tools to play with, no?

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 5 Posts in Topic:
string splitting
xyz <lavanyareddy.p@[E  2008-04-29 10:43:22 
Re: string splitting
"Hakusa@[EMAIL PROTE  2008-04-29 17:38:05 
Re: string splitting
Alexey Stepanyan <alex  2008-04-29 17:38:54 
Re: string splitting
Alexey Stepanyan <alex  2008-04-29 17:40:29 
Re: string splitting
"Devdatt Lad" &  2008-04-30 10:41:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 19 20:01:18 CDT 2008.