Correct Bash and shell script variable capitalization

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 … Read more

Is there a way to style a TextView to uppercase all of its letters?

I would like to be able to assign a xml attribute or style to a TextView that will make whatever text it has in ALL CAPITAL LETTERS. The attributes android:inputType=”textCapCharacters” and android:capitalize=”characters” do nothing and look like they are for user inputed text, not a TextView. I would like to do this so I can … Read more

How to capitalize the first character of each word in a string

Is there a function built into Java that capitalizes the first character of each word in a String, and does not affect the others? Examples: jon skeet -> Jon Skeet miles o’Brien -> Miles O’Brien (B remains capital, this rules out Title Case) old mcdonald -> Old Mcdonald* *(Old McDonald would be find too, but … Read more

How can I capitalize the first letter of each word in a string?

s=”the brown fox” …do something here… s should be: ‘The Brown Fox’ What’s the easiest way to do this? 22 s 22 The .title() method of a string (either ASCII or Unicode is fine) does this: >>> “hello world”.title() ‘Hello World’ >>> u”hello world”.title() u’Hello World’ However, look out for strings with embedded apostrophes, as … Read more