Method Reference: string.reverse

string: newstr = reverse (str)

Reverse order of characters in string array.

newstr = reverse (str) reverses the order of the characters in every each element of the string array str. newstr is a string array of the same size as str.

Source Code: string

Example: 1

reverse reverses the characters within each string.

 s = string ({'Hello'; 'World'})
s =
  2x1 string array

    "Hello"    
    "World"
 reverse (s)
ans =
  2x1 string array

    "olleH"    
    "dlroW"