ends_with.cpp 479 B

1234567891011121314151617181920
  1. //
  2. // $Id$
  3. //
  4. #include<__vic/string_utils.h>
  5. #include<string>
  6. namespace __vic {
  7. //----------------------------------------------------------------------------
  8. bool ends_with(const char *s, size_t s_len, const char *suff, size_t suff_len)
  9. {
  10. if(s_len < suff_len) return false;
  11. return std::string::traits_type::compare(
  12. s + (s_len - suff_len), suff, suff_len) == 0;
  13. }
  14. //----------------------------------------------------------------------------
  15. } // namespace