strip
Trims leading and trailing characters from strings.
Syntax
R = strip(s, mode)
R = strip(s, mode, trim)
Inputs
- s
- Input string(s) to be trimmed. If s is a cell, all elements should be of type string.
- mode
- Indicates whether leading and/or trailing characters should be trimmed from s. Valid values are 'both', 'left', 'right'.
- trim
- Optional string specifying characters(s) to be trimmed. If trim is a cell, all elements should be of type string. Whitespace is the default if no string is specified.
Outputs
- R
- R will have the trimmed strings. If s is a cell, R will also be a cell.
Examples
R = strip(',,,this is a test,,', 'both', ',')
R = this is a test
R = strip({',,,this is a test****0123******????***','foo2*'}, 'right', {',', ' ', '?', '*', '0123'})
R =
[1,1] ,,,this is a test
[1,2] foo2
}