Link Details

Link 17381 thumbnail
User 223423 avatar

By bmorampudi
via bhanu.blogspot.com
Published: Apr 02 2007 / 15:30

In Ruby, upcase! and downcase! don't function similarly to upcase and downcase in case the string already contains all upper case or lower case characters. This post shows what the gotcha is.
  • 6
  • 6
  • 1562
  • 357

Comments

Add your comment
User 107114 avatar

daniel replied ago:

0 votes Vote down Vote up Reply

I think there are some typos in the article, but it's interesting none-the-less.

Honestly, I don't expect *anything* to be returned from the bang methods.

User 218521 avatar

cosmina replied ago:

0 votes Vote down Vote up Reply

We also learn that some people don't read the docs ;)

User 201282 avatar

jmcantrell replied ago:

0 votes Vote down Vote up Reply

on the second part of the example, did he mean for that upcase to be the bang upcase? If not, the example really doesn't make any sense.
Otherwise, this article is pretty much common sense... bang operators act on the object in-place.

User 223423 avatar

bmorampudi replied ago:

0 votes Vote down Vote up Reply

daniel, jmcantrell

I have fixed the typos. The "upcase" method in the second instance indeed should be "upcase!"

Thanks.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (6)



Voters Against This Link (6)