title: Can we split, manipulate and rejoin a string in c++ in one statement?
body: <p>This is a bit of a daft question, but out of curiousity would it be possibly to split a string on comma, perform a function on the string and then rejoin it on comma in one statement with C++?</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>string dostuff(const string&amp; a) {
    return string("Foo");
  }
  
  int main() {
    string s("a,b,c,d,e,f");
  
    vector&lt;string&gt; foobar(100);
    transform(boost::make_token_iterator&lt;string&gt;(s.begin(), s.end(), boost::char_separator&lt;char&gt;(",")),
              boost::make_token_iterator&lt;string&gt;(s.end(), s.end(), boost::char_separator&lt;char&gt;(",")),
              foobar.begin(),
              boost::bind(&amp;dostuff, _1));
    string result = boost::algorithm::join(foobar, ",");
  }
  </code></pre>
  
  <p>So this would result in turning <code>"a,b,c,d,e,f"</code> into <code>"Foo,Foo,Foo,Foo,Foo,Foo"</code></p>
  
  <p>I realise this is OTT, but was just looking to expand my boost wizardry. </p>