|
Boost : |
From: Lars Schouw (schouwla_at_[hidden])
Date: 2008-05-28 10:01:28
Got it now ;)#include<iostream>#include<boost/tokenizer.hpp>#include<string>void
{
string s =
{main()usingnamespacestd;usingnamespaceboost;"LDNTOK";if(s.size() > 3)// insert comma by every 3 charssize_t len = s.size();
{
s.insert( i, 1,
}
tokenizer<escaped_list_separator<
{
cout << *beg << std::endl;for( size_t i = ((len-1)%3) + 1; i < len; i+=4, ++len )',');char> > tok(s);for(tokenizer<escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg)// load holiday calendar *beg}
}// else just load holiday calendar}
----- Original Message ----
From: Lars Schouw <schouwla_at_[hidden]>
To: boost_at_[hidden]
Sent: Wednesday, May 28, 2008 10:20:24 PM
Subject: tokenizer
Can I use the tokenizer to seperate my command and every 3 chars?
I have a string
A) XXXYYY
B) XXX,YYY
Can I use the tokenizer to seperate these?
I want to to check for strings of type A and then B.
Here is some code that does B but what about A before?
#include<iostream>#include<boost/tokenizer.hpp>#include
<string>void
{
string s1 =
string s =
tokenizer<escaped_list_separator<
cout << *beg <<
}
}main()usingnamespacestd;usingnamespaceboost;"LDNTOK";"XXX,YYY";char> > tok(s);for(tokenizer<escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg){"\n";
Cheers.
Lars
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk