Main Content

strtrim

Remove leading and trailing white space from string in Stateflow chart

Since R2021b

Description

newStr = strtrim(str) removes the leading and trailing whitespace characters from the string str.

example

Note

The strtrim operator is not supported in Stateflow® charts that use C as the action language.

Examples

expand all

Remove the leading and trailing spaces and return the string "Hello, world!"

str = "    Hello, world!   ";
newStr = strtrim(str);

Stateflow chart that uses the strtrim operator in a state.

Input Arguments

expand all

Input string, specified as a string scalar. Enclose literal strings with double quotes.

Example: "Hello"

Limitations

  • This operator does not support the use of Stateflow structure fields or messages. For more information about structures in Stateflow, see Access Bus Signals.

Version History

Introduced in R2021b