Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: String manipulation

by LanX (Cardinal)
on Dec 15, 2012 at 13:54 UTC ( #1008984=note: print w/replies, xml ) Need Help??


in reply to String manipulation

lets golf! =)
DB<101> s/(\d)\w\w /$1 / for @a=("December 14th 2012", "December 21s +t 2012" , "December 22nd 2012") => "" DB<102> @a => ("December 14 2012", "December 21 2012", "December 22 2012")

UPDATE:

a bit more fail safe!

DB<126> map {/^(\w+ \d\d?)\w\w( \d\d\d\d)$/; "$1$2"} "December 1th 2 +012", "December 21st 2012" , "December 22nd 2012" => ("December 1 2012", "December 21 2012", "December 22 2012")

Cheers Rolf

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2021-04-13 17:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?