A
Atlas
Thank you, this problem has bothered me for several years.
I want to extract words from an input file stream. Once a word,
ifstream should use the operator >>. But by default, it's delimited
only by white spaces. I need it to consider all non-alphabet as
delimiters.
For example, input "Hello, year 2005's halloween!", will be extracted
one by one as: hello year s halloween
In c, I can use
char *strtok( char *strToken, const char *strDelimit );
to do this, but is there anything like it in STL string/stream? My
current solution is reading character by character and then judge by
isalpha(c). It's too awkward.
I want to extract words from an input file stream. Once a word,
ifstream should use the operator >>. But by default, it's delimited
only by white spaces. I need it to consider all non-alphabet as
delimiters.
For example, input "Hello, year 2005's halloween!", will be extracted
one by one as: hello year s halloween
In c, I can use
char *strtok( char *strToken, const char *strDelimit );
to do this, but is there anything like it in STL string/stream? My
current solution is reading character by character and then judge by
isalpha(c). It's too awkward.