Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Five Ways to Reverse a String of Words (C#, Perl 5, Perl6, Ruby, Haskell)

by ambrus (Abbot)
on Dec 12, 2006 at 22:03 UTC ( #589433=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    >>> def reverseWords(words):
    ...     return ' '.join(words.split()[::-1])
    ... 
    >>> reverseWords("  one   two three four    ")
    'four three two one'
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://589433]
help
Chatterbox?
[Discipulus]: :=)
[johngg]: hippo Yes, that's a cracker :-D
[Discipulus]: hippo take a look at Re^2: Cookie->fetch problem
[Discipulus]: oh and dont miss my last poetry!

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2017-05-26 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?