Skip to main content

trim

Takes either one or two arguments as string. If one argument is given, the leading and trailing white-spaces of given string are removed. When two arguments are given, the second string is removed from the beginning and end of the first string.

trim(str)
# Or
trim(str, substring)

Parameters#

  • str: Target string
  • substring: string that needs to be removed from the beginning and end

Returns#

  • modified string