reverse - Reverse order of characters in strings - MATLAB (original) (raw)
Main Content
Reverse order of characters in strings
Syntax
Description
[newStr](#bu5rtiu-newStr) = reverse([str](#bu5rtiu-str))
reverses the order of the characters in str
.
Examples
Reverse the strings in a string array and find strings that read the same when reversed.
str = ["airport","control tower","radar","runway"]
str = 1×4 string "airport" "control tower" "radar" "runway"
newStr = 1×4 string "tropria" "rewot lortnoc" "radar" "yawnur"
tf = 1×4 logical array
0 0 1 0
Input Arguments
Input text, specified as a string array, character vector, or cell array of character vectors.
Output Arguments
Output text, returned as a string array, a character vector, or a cell array of character vectors. str
andnewStr
are the same data type.
Extended Capabilities
Thereverse
function fully supports tall arrays. For more information, see Tall Arrays.
Usage notes and limitations:
str
must be a string scalar, a character vector, or a cell array containing not more than one character vector.
Version History
Introduced in R2016b