Split Strings in Cpp With Boost

I just wrote about how to trim strings with boost. The code where I first needed to trim a string, was actually very simple naive parser where strings of key value pairs would be split, and then each part trimmed to ensure that both key and value was without leading and trailing whitespace. When you want to split a string in c++ you again probably want to use the boost library - more specifically boost/algorithm/string/split.hpp. This allows you to split a string by a character (or rather a substring) into a vector of strings. Like last time the progam is compiled using clang++ -std=c++0x -stdlib=libc++ test.cpp -o test and then run by calling ./test The output should be: