Main Content

reverse

Reverse order of characters in strings

Description

example

newStr = reverse(str) reverses the order of the characters in the string str. Use this operator in the Requirements Table block.

Examples

expand all

In a Requirements Table block, create a requirement that reverses the order of the characters in the string "Hello, world!". The output is "!dlrow ,olleH".

y = reverse("Hello, world!")

This example shows a requirement that reverses the order of the 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

|