| Author |
Message |
Bit byte *nix forums beginner
Joined: 23 Mar 2006
Posts: 33
|
Posted: Fri Jul 21, 2006 2:40 am Post subject:
Tokenizer
|
|
|
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
|
Posted: Fri Jul 21, 2006 2:41 am Post subject:
Re: Tokenizer
|
|
|
* 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
|
Posted: Fri Jul 21, 2006 2:51 am Post subject:
Re: Tokenizer
|
|
|
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 |
|
 |
|