I want to make an event that when entering text into the text box the first letter of the text to be capitalized automatically in fastest way.
What is the best approach to capitalize words in a string?
I run across many shell scripts with variables in all caps, and I've always thought that there is a severe misunderstanding with that. My understanding is that, by convention (and perhaps by necessity long ago), environment variables are in all-caps.
But in modern scripting environments like Bash, I have always preferred the convention of lower-case names for temporary variables, and upper-case ones only for exported (i.e. environment) variables. For example:
#!/usr/bin/env bashyear=`date +%Y`echo "It is $year."export JAVA_HOME="$HOME/java"
That has always been my take on things. Are there any authoritative sources which either agree or disagree with this approach, or is it purely a matter of style?
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"
Is there a simple way to convert a string to title case? E.g.
john smith becomes
John Smith. I'm not looking for something complicated like John Resig's solution, just (hopefully) some kind of one- or two-liner.