+ # Returns `self` removed from its last `\n` (if any).
+ #
+ # assert "Hello\n".chomp == "Hello"
+ # assert "Hello".chomp == "Hello"
+ # assert "\n\n\n".chomp == "\n\n"
+ #
+ # This method is mainly used to remove the LINE_FEED character from lines of text.
+ fun chomp: SELFTYPE
+ do
+ if self.chars.last != '\n' then return self
+ return substring(0, length-1)
+ end
+