assert " \n\thello \n\t".r_trim == " \n\thello"
Char::is_whitespace
determines what is a whitespace.
# Removes the whitespaces at the end of self
#
# ~~~
# assert " \n\thello \n\t".r_trim == " \n\thello"
# ~~~
#
# `Char::is_whitespace` determines what is a whitespace.
fun r_trim: SELFTYPE
do
var iter = self.chars.reverse_iterator
while iter.is_ok do
if not iter.item.is_whitespace then break
iter.next
end
if iter.index < 0 then return self.empty
return self.substring(0, iter.index + 1)
end
lib/core/text/abstract_text.nit:477,2--493,4