niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » C++
Tokenizer
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Bit byte
*nix forums beginner


Joined: 23 Mar 2006
Posts: 33

PostPosted: Fri Jul 21, 2006 2:40 am    Post subject: Tokenizer Reply with quote

Does anyone know how I may tokenize a string into words - while ignoring
any whitespace between the words ?
Back to top
Alf P. Steinbach
*nix forums Guru


Joined: 09 Mar 2005
Posts: 1855

PostPosted: Fri Jul 21, 2006 2:41 am    Post subject: Re: Tokenizer Reply with quote

* Bit byte:
Quote:
Does anyone know how I may tokenize a string into words - while ignoring
any whitespace between the words ?

std::istringstream stream( someString );
std::string firstWord;

if( stream >> firstWord )
{
std::cout << "The first word is " << firstWord << ".\n";
}



--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Back to top
Bit byte
*nix forums beginner


Joined: 23 Mar 2006
Posts: 33

PostPosted: Fri Jul 21, 2006 2:51 am    Post subject: Re: Tokenizer Reply with quote

Alf P. Steinbach wrote:

Quote:
* Bit byte:

Does anyone know how I may tokenize a string into words - while
ignoring any whitespace between the words ?


std::istringstream stream( someString );
std::string firstWord;

if( stream >> firstWord )
{
std::cout << "The first word is " << firstWord << ".\n";
}




Thanks
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Mon Dec 01, 2008 8:09 pm | All times are GMT
navigation Forum index » Programming » C++
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Tokenizer Function (plus rant on strtok documentation) Robbie Hatley C++ 18 Tue Jul 11, 2006 3:09 am
No new posts tokenizer compboy C 6 Tue May 02, 2006 3:34 pm
No new posts Help with Tokenizer Please electrixnow C++ 1 Sun Feb 26, 2006 7:46 pm
No new posts Issues with npos? writing a non-boost string tokenizer JohnFlyTn@msn.com C++ 1 Thu Feb 16, 2006 4:33 pm
No new posts readline tokenizer newline sticky wicket Arthur python 0 Tue Feb 07, 2006 2:55 am

Ringtones | Credit Card | Credit Report | Car Finance | Debt Management
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.3988s ][ Queries: 16 (0.3248s) ][ GZIP on - Debug on ]