Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by IulianU (Initiate)
on Dec 14, 2006 at 23:04 UTC ( #589930=note: print w/ replies, xml ) Need Help??


in reply to Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)

Still in Java-dom, here's a version in Groovy:
def reverseWords( str ) { str.split('\\s+'). findAll {it.length() > 0}. reverse().join(' ') }
  • Comment on Re: Five Ways to Reverse a String of Words (C#, Perl 5, Perl 6, Ruby, Haskell)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://589930]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2016-06-28 02:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (348 votes). Check out past polls.