diff --git a/string.c b/string.c index bea38df4bc..604304fda2 100644 --- a/string.c +++ b/string.c @@ -8293,6 +8293,11 @@ chompped_length(VALUE str, VALUE rs) return len; } +/*! + * Returns the seperator for arguments of rb_str_chomp. + * + * @return returns rb_ps ($/) as default, the default value of rb_ps ($/) is "\n". + */ static VALUE chomp_rs(int argc, const VALUE *argv) { @@ -9273,6 +9278,15 @@ rb_str_end_with(int argc, VALUE *argv, VALUE str) return Qfalse; } +/*! + * Returns the length of the prefix to be deleted in the given str, + * returning 0 if str does not start with the prefix. + * + * @param str the target + * @param prefix the prefix + * @retval 0 if the given str does not start with the given prefix + * @retval Positive-Integer otherwise + */ static long deleted_prefix_length(VALUE str, VALUE prefix) { @@ -9339,6 +9353,15 @@ rb_str_delete_prefix(VALUE str, VALUE prefix) return rb_str_subseq(str, prefixlen, RSTRING_LEN(str) - prefixlen); } +/*! + * Returns the length of the suffix to be deleted in the given str, + * returning 0 if str does not end with the suffix. + * + * @param str the target + * @param suffix the suffix + * @retval 0 if the given str does not end with the given suffix + * @retval Positive-Integer otherwise + */ static long deleted_suffix_length(VALUE str, VALUE suffix) {