Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Capitalize first letter in a string?

by autark (Friar)
on Nov 04, 2000 at 23:03 UTC ( #40014=note: print w/replies, xml ) Need Help??


in reply to Capitalize first letter in a string?

You can use the ucfirst function to do this. Assuming you want to uppercase the first character in a string:
$string = "to my beloved wife"; $string = ucfirst $string; print $string;
This will print "To my beloved wife". You shouldn't have to test for lowercase as ucfirst will not mangle any characters already in uppercase.

Autark.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2020-11-27 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?