in reply to Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)
My dutiful contribution in languages not listed in OP; first Rexx ...
say word_reverse( " one two three four " ) exit word_reverse: procedure parse arg string new = '' do w = 1 to words( string ) new = word( string , w ) new end return strip( new , 'T' )
... and similar in (a)sh (as found on FreeBSD 6.x) ...
word_reverse() { local string="$1" new='' for s in $string do new="$s $new" done printf "%s" "${new%% }" } word_reverse " one two three four "
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)
by sgt (Deacon) on Dec 15, 2006 at 00:24 UTC |
In Section
Meditations