2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 04:22:16 +00:00

Implement str::endswith()

This commit is contained in:
Wei-Ming Yang
2015-10-18 18:41:09 +08:00
committed by Stefan Seefeld
parent bc2f77a3db
commit 03adaee6d2

View File

@@ -162,6 +162,22 @@ bool str_base::endswith(object_cref suffix) const
return result;
}
bool str_base::endswith(object_cref suffix, object_cref start) const
{
bool result = _BOOST_PYTHON_ASLONG(this->attr("endswith")(suffix,start).ptr());
if (PyErr_Occurred())
throw_error_already_set();
return result;
}
bool str_base::endswith(object_cref suffix, object_cref start, object_cref end) const
{
bool result = _BOOST_PYTHON_ASLONG(this->attr("endswith")(suffix,start,end).ptr());
if (PyErr_Occurred())
throw_error_already_set();
return result;
}
BOOST_PYTHON_DEFINE_STR_METHOD(expandtabs, 0)
BOOST_PYTHON_DEFINE_STR_METHOD(expandtabs, 1)