Re: Probably a dumb s/// question.

From: Glenn Jackman (xx087_at_freenet.carleton.ca)
Date: 03/16/05

  • Next message: sfgroups_at_gmail.com: "translate this send into perl"
    Date: 16 Mar 2005 16:51:18 GMT
    
    

    At 2005-03-16 11:14AM, Mark Healey <die@spammer.die> wrote:
    > For example I'd like to turn
    > the quick brown fox jumped over the lazy dogs.
    > to
    > The Quick Brown Fox Jumped Over the Lazy Dogs.
    >
    > Is this doable on a single line?

        my $string = 'the quick brown fox jumped over the lazy dogs.';
        my $String = join ' ', map {ucfirst lc} split ' ', $string;

    That forces your string to lower case first then capitalizes the first
    letter. It won't preserve whitespace though.

    -- 
    Glenn Jackman
    NCF Sysadmin
    glennj@ncf.ca
    

  • Next message: sfgroups_at_gmail.com: "translate this send into perl"

    Relevant Pages

    • Re: Probably a dumb s/// question.
      ... Glenn Jackman wrote: ... >> the quick brown fox jumped over the lazy dogs. ... It won't preserve whitespace though. ... use Perl; ...
      (comp.lang.perl.misc)
    • Re: Probably a dumb s/// question.
      ... > the quick brown fox jumped over the lazy dogs. ... That forces your string to lower case first then capitalizes the first ... It won't preserve whitespace though. ... Glenn Jackman ...
      (comp.lang.perl.misc)