Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Answer: What is the best way to capitalize a string?

by galande (Initiate)
on Nov 24, 2000 at 13:32 UTC ( #43203=categorized answer: print w/replies, xml ) Need Help??

Q&A > strings > What is the best way to capitalize a string? - Answer contributed by galande

You can use uc or lc built-in functions to change case. If you wanto to change case of first character only, then use ucfirst or lcfirst functions.

$lower = "name"; $upper = "NAME"; print uc($lower),"\n"; ### This will print : NAME print lc($upper),"\n"; ### This will print : name print ucfirst($lower),"\n"; ## This will print : Name print lcfirst($upper),"\n"; ## This will print : nAME

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (17)
As of 2016-10-27 15:16 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (365 votes). Check out past polls.