分类: C/C++
2007-11-10 19:26:55
//#include "stdafx.h"
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
void filter_text( vector
#define D
#ifdef D
void filter_text( vector
{
vector
vector
// 如果用户没有提供 filter, 则缺省使用最小集
if ( ! filter.size() )
filter.insert( 0, "\".," );
while ( iter != iter_end ) {
string::size_type pos = 0;
// 对于找到的每个元素, 将其删除
while (( pos = (*iter).find_first_of( filter, pos ))
!= string::npos )
(*iter).erase(pos,1);
iter++;
}
iter = words->begin();
while ( iter != iter_end ) {
cout << *iter << endl;
iter++;
}
}
vector
assert(!strText.empty());
vector
string::size_type pos = 0,prevPos=0;
while(( pos=strText.find_first_of(' ',pos))!=string::npos){
svect->push_back(strText.substr(prevPos,pos-prevPos));
prevPos=++pos;
}
for(vector
string str=*itr;
cout<
if(svect->size() == 0)
svect->push_back( strText);
return svect;
}
int main() {
string str1="magical but untamed. \"Daddy, shush, there is no such thing,";
string str="/.+(STL).*$1/" ;
string filt_elems( "\",.;:!?+*$0123456789)(");
filter_text(sperator(str),filt_elems);
}
#endif