strrev - reverse string


<strrev $str [$mode]>

strrev reverses the order of characters in each value of $str.

The optional $mode argument is a stringcomparemode-style (here) compare mode to use; the default is the current apicp stringcomparemode. The $mode values are used in the same order as $str values. Currently the only pertinent $mode flag is "iso-8859-1", which determines whether to interpret text as ISO-8859-1 or UTF-8: if UTF-8, the individual bytes in a contiguous UTF-8 sequence are not reversed, and ISO-8859-1 characters (or bad bytes in a UTF-8 sequence) will be re-mapped to UTF-8, which may cause the string to lengthen. The $mode argument was added in version 6.

strrev returns the values of $str reversed (as character not byte strings), according to stringcomparemode $mode.


<strrev "A man, a plan, a canal - Panama!">

The return value in $ret would be "!amanaP - lanac a ,nalp a ,nam A".

The strrev function was added Feb. 5 1997.

Copyright © Thunderstone Software     Last updated: Oct 24 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.