Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Do you know where your variables are?
 
PerlMonks  

Re: Capitalize First Letter of Each Word

by inman (Curate)
on Jun 30, 2005 at 09:19 UTC ( [id://471301]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Capitalize First Letter of Each Word

#! /usr/bin/perl -w use strict; while (<DATA>) { s/\b(\w)(\w*)/uc($1).lc($2)/ge; print; } __DATA__ THIS iS a Text IN TITLE CASE THIS IS TESTING JOE MARCONES RESIDENTIAL MAINTENANCE COMPANY

Replies are listed 'Best First'.
Re^2: Capitalize First Letter of Each Word
by rev_1318 (Chaplain) on Jun 30, 2005 at 10:07 UTC
    or just:
    ... s/\b(\w)(\w*)/\U$1\L$2/g ...
    no need for /ie...

    Paul

      and the \b isn't needed either as the regex will match as many word characters as possible each time.
Re^2: Capitalize First Letter of Each Word
by Your Mother (Archbishop) on Jul 11, 2005 at 17:03 UTC

    Mmmmmmm...

    __DATA__ This isn't right And I'm wrong too e-mail is nice when capped correctly &c

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://471301]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.