return naNum( str.starts_with(rhs) );
}
+/**
+ * Check whether string ends with other string
+ */
+static naRef f_ends_with(naContext c, naRef me, int argc, naRef* args)
+{
+ nasal::CallContext ctx(c, argc, args);
+ nasal::String str = nasal::from_nasal<nasal::String>(c, me),
+ rhs = ctx.requireArg<nasal::String>(0);
+
+ return naNum( str.ends_with(rhs) );
+}
+
/**
* Helper to convert size_t position/npos to Nasal conventions (-1 == npos)
*/
string_module.set("compare", f_compare);
string_module.set("starts_with", f_starts_with);
+ string_module.set("ends_with", f_ends_with);
string_module.set("find", f_find);
string_module.set("find_first_of", f_find_first_of);
string_module.set("find_first_not_of", f_find_first_not_of);