nop has asked for the wisdom of the Perl Monks concerning the following question:
I want to capitalize the first and last letter of a string.
This works but strikes me as excessive:
(This title of this posting is a joke, I know there isn't uclast)
nop
This works but strikes me as excessive:
Is there something preferable?$user =~ s/^(.)(.*)(.)$/\u$1\L$2\E\u$3/; # capitalize 1st and last + letter
(This title of this posting is a joke, I know there isn't uclast)
nop
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: ucfirst(uclast(lc($user))) ?
by Juerd (Abbot) on Mar 09, 2002 at 13:52 UTC | |
by jryan (Vicar) on Mar 09, 2002 at 23:16 UTC | |
by Juerd (Abbot) on Mar 09, 2002 at 23:24 UTC | |
by theguvnor (Chaplain) on Mar 09, 2002 at 15:58 UTC | |
by tstock (Curate) on Mar 09, 2002 at 21:55 UTC | |
Re: ucfirst(uclast(lc($user))) ?
by theguvnor (Chaplain) on Mar 09, 2002 at 13:47 UTC | |
by Kanji (Parson) on Mar 10, 2002 at 21:53 UTC | |
by theguvnor (Chaplain) on Mar 10, 2002 at 21:57 UTC | |
Re: ucfirst(uclast(lc($user))) ?
by seattlejohn (Deacon) on Mar 10, 2002 at 04:48 UTC | |
Re (tilly) 1: ucfirst(uclast(lc($user))) ?
by tilly (Archbishop) on Mar 10, 2002 at 01:41 UTC |
Back to
Seekers of Perl Wisdom