Peter wrote:
> I love Ruby but this is cumbersome.
Well, i don't think this is a Ruby specific behavior. I have just tried
the same thing in Python:

>>> s = "this is a String"
>>> s.capitalize()
'This is a string'

i.e. it has absolutely the same semantics as in Ruby.

> There are plenty of situations where people want to
> capitalize only the first letter.
The problem is not the capitalization of the first letter (as this
works), but rather that it turns the other first-letters to lowercase.
I don't know why the capitalize() function is defined like this - both
in Python and Ruby...

> By saying:
> string[0,1].capitalize! with ! should read like:
> Capitalize only the first character within string 'string'
What about this:
x = string[0,1]
x.capitalize!

Should this still capitalize only the first character within string
'string'? I think the answer is obviously no. But your code is
essentially the same, without using the temporary variable x.


bw,
Peter