Main Content

strtrim

Remove leading and trailing white space from string

Description

example

newStr = strtrim(str) removes the leading and trailing whitespace characters from the string str. Use this operator in the Requirements Table block.

Examples

expand all

In a Requirements Table block, create a requirement that deletes the leading and trailing space characters in a string.

y = strtrim("    Hello, world!      ")

This example shows a requirement that deletes the leading and trailing space characters in the string " Hello, world! ".

Input Arguments

expand all

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

Example: "Hello"

Data Types: string

Output Arguments

expand all

Output string, returned as a string scalar.

Limitations

  • This operator does not support the use of Simulink.Bus object fields.

Version History

Introduced in R2022b

See Also