跳到正文
本页尚未翻译成中文,以下为英文原文。 查看英文版

trimspace Function ​

trimspace removes any space characters from the start and end of the given string.

This function follows the Unicode definition of "space", which includes regular spaces, tabs, newline characters, and various other space-like characters.

Examples ​

shellsession
> trimspace("  hello\n\n")
hello
  • chomp removes just line ending characters from the end of a string.

基于 MPL-2.0 许可证发布。