String::trim_right()
Remove whitespace at the end of this string.
" foo ".trim_right() //-> " foo"
public method trim_right(this: String): String { let i = this.len() - 1 while i >= 0 { let char = this.substring(i, i + 1) if char != " " { break } i -= 1 } this.substring(0, i + 1) }