How do I make the first letter of a string uppercase, but not change the case of any of the other letters?
"this is a test"->
"This is a test"
"the Eiffel Tower"->
"The Eiffel Tower"
I am having trouble with the capitalization of names using PHP. There are some names that have 2 capital letters in them (ex: McCall). When storing a users name that registers for our website, we run the following code:
$name = ucwords(strtolower(trim($_SESSION['last_name']))) ;
What this does is change 'mccall' to 'Mccall'. What we need is a way to check if the first 2 letters begin with 'Mc' and if so, the 3rd letter will be capitalized as well changing the name to 'McCall'.
Any help is greatly appreciated.
How are you, this is very weird thing I got today.
<?php echo bloginfo( 'name' ); ?> // this return How Are You<?php echo strtoupper(bloginfo( 'name' )); ?> // this also return How Are You<?php echo strtoupper( 'How Are You' ); ?> //this return HOW ARE YOU
I think second should return HOW ARE YOU, it's very weird.I am not sure the reason of this thing.
I am using titleForHeaderInSection to show a header for a UITableView section. It worked fine with the iOS6 SDK, but the iOS7 SDK shows the header in all CAPS.
I guess it's part of Apple's updated Human Interface Guidelines; all examples in there show headers in all caps. Also, all section headers in Settings on my iPhone are in all caps.
However, I wonder if there is a way around that. Normally, I wouldn't mind showing caps if that improves consistency, but when I need to show people's names in a section header, it's a bit awkward.
Anybody any idea how to get around to capitalization?
Is there a function built into Java that capitalizes the first character of each word in a String, and does not affect the others?
Miles O'Brien(B remains capital, this rules out Title Case)
Old McDonald would be find too, but I don't expect it to be THAT smart.)
A quick look at the Java String Documentation reveals only
toLowerCase(), which of course do not provide the desired behavior. Naturally, Google results are dominated by those two functions. It seems like a wheel that must have been invented already, so it couldn't hurt to ask so I can use it in the future.