Is there a way to cnvert first letter alone in a string to upper case.
For eg: diamond should be converted to Diamond.
Thanks in Advance,
Kinny
Is there a way to cnvert first letter alone in a string to upper case.
For eg: diamond should be converted to Diamond.
Thanks in Advance,
Kinny
using Perl:
print ucfirst("diamond");
cheers,
Devaraj Takhellambam
using perl one liner
perl -e "print ucfirst('diamond');"
how's this....!
echo 'kinny' | sed -e 's/^\(.\)/\U\1/'
or,
/home1->echo 'diamond' | awk '{sub(".",substr(toupper($0),1,1));print}'
Diamond
/home1->
bash and tr :
s="diamond"
echo $(echo ${s:0:1} | tr [a-z] [A-Z])${s:1}
using perl
echo "diamonds" | perl -wlne 'print "\u$_";'
o/p:-
Diamonds