Back to the Virginia Tech Hokies Newsfeed

Remove leading and trailing characters from strings (2024)

Related Topics: string

Remove leading and trailing characters from strings

collapse all in page

Syntax

newStr = strip(str)

newStr = strip(str,side)

newStr = strip(___,stripCharacter)

Description

example

newStr = strip(str) removes all consecutive whitespace characters from the beginning and end of str, and returns the result as newStr.

example

newStr = strip(str,side) removes all consecutive whitespace characters from the side specified by side. The side argument can be 'left', 'right', or 'both'.