📜  c++ 检查 const char* 是否有后缀 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:52.518000             🧑  作者: Mango

代码示例1
#include 

// works with const char* 
assert(boost::algorithm::ends_with("mystring", "ing"));

// also works with std::string
std::string haystack("mystring");
std::string needle("ing");
assert(boost::algorithm::ends_with(haystack, needle));

std::string haystack2("ng");
assert(! boost::algorithm::ends_with(haystack2, needle));