• Post Reply Bookmark Topic Watch Topic
  • New Topic

String.toLowerCase method and locale  RSS feed

 
Omkar Shetkar
Ranch Hand
Posts: 100
2
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I was just wondering why toLowerCase(Locale locale) method of String class needs locale as an input parameter?
As I understand from the below link, all the characters in unicode which have cases are mapped between lower case & upper case.

Unicode lowercase mapping table

Even toLowerCase() method, internally uses default locale to compute lower case.

Thus, to convert from lower to upper or vice-versa, it is enough to have the knowledge of above table.

Thus, I don't see any need for input of locale. Is it anything to do with optimizing the process of conversion of case?


Please clarify.

Thanks,
Omkar
 
Paul Clapham
Sheriff
Posts: 22828
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You linked to the table which explains how to map lower case to upper case, which isn't the table you meant to link to. However aside from that, if you provide a Turkish locale to that method you'll find that the lower-case version of I is ı and not i as you might expect from the table you meant to link to. Check out the Wikipedia page about the Turkish alphabet for more information.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!