boostsplit()
#include <iostream>
#include <vector>
#include <string>
#include <boost/algorithm/string.hpp>
using namespace std;
int main()
{
    // String to split
    string str = "You're supposed to see this!|NOT THIS!!!!!!";
    // Line container
    vector<string> lines;
    // Splits string
    boost::split(lines, str, boost::is_any_of("|"), boost::token_compress_on);
    // Outputs 1 half of the split string
    cout << lines.at(0).c_str() << endl;
    // Waits for input before program exits
    cin.get();
    return 0;
}
以下是 psuedocode 中 的程式 :
宣告字串 str 並將其設定為 “你應該看到這個!|不是這個!!!!!!” 。
宣告向量 線的型別字串。
**** 如果正規表示式 “|”將字串 str 拆分為向量行找到了。 **
**** 在行中的索引 0 處列印物件。
獲得輸入。