Main Content

strtrim

Remove leading and trailing white space from a string

Description

example

newStr = strtrim(str) removes leading and trailing whitespace characters from str and returns the result as newStr.

Note

Only Stateflow® charts that use MATLAB® as the action language support the strtrim operator.

Examples

expand all

h = "    Hello, world!   "
x = strtrim(h)

Stateflow chart that uses the strtrim operator in a state.

Results from stateflow chart that uses the strtrim operator in a state.

Limitations

Introduced in R2021b