int main(){
struct tokens : std::ctype<char>
{
tokens() : std::ctype<char>(get_table()) {}
static std::ctype_base::mask const* get_table()
{
typedef std::ctype<char> cctype;
static const cctype::mask *const_rc = cctype::classic_table();
static cctype::mask rc[cctype::table_size];
std::memcpy(rc, const_rc, cctype::table_size * sizeof(cctype::mask));
rc['/'] = std::ctype_base::space;
rc['$'] = std::ctype_base::space;
return &rc[0];
}
};
std::string FormatMsg = "AB/LK$VD$SA$PO";
cin >> FormatMsg;
std::stringstream ss(FormatMsg);
ss.imbue(std::locale(std::locale(), new tokens()));
std::istream_iterator<std::string> begin(ss);
std::istream_iterator<std::string> end;
std::vector<std::string> vstrings(begin, end);
std::copy(vstrings.begin(), vstrings.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
system("Pause");
}
从此代码中,我想获取AB,LK和SA,并从单独的CSV文件中寻找相似的组件。谁能帮我吗?
这个问题是std::regex
的哭声。