Main Content

reverse

Reverse order of characters in strings

Description

example

newStr = reverse(str) reverses the order of the characters in the string str.

Note

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

Examples

expand all

Reverse the order of characters and return the string "!dlrow ,olleH"

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

Stateflow chart that uses the reverse operator in a state.

Input Arguments

expand all

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

Example: "Hello"

Limitations

Version History

Introduced in R2021b