'''[http://www.tcl.tk/man/tcl/TclCmd/string.htm#M42%|%string reverse]''' , a subcommand of the [Tcl Commands%|%built-in] [string] command, reverses strings ** Synopsis ** : '''string reverse''' ''string'' ** Description ** Returns a string containing the characters of its input argument, ''string'', in reverse order. Implemented in the [Changes in Tcl/Tk 8.5], as part of [TIP] #272[http://tip.tcl.tk/272.html]. Workaround substitute for 8.4: ======none proc string'reverse str { set res {} set i [string length $str] while {$i > 0} {append res [string index $str [incr i -1]]} set res } ;# RS % string'reverse "hello, world" dlrow ,olleh ====== ---- '''Implementation notes''' This command converts its argument to the "unicode" object type so that it doesn't have to use Tcl_UtfPrev() masses of times. ** See Also ** [SYStems]: contains a discussion on reversing strings <> Tcl syntax | Command | String Processing