File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using the unicode library

 
Jessica Benady
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do you convert lower case c to uppercase C without an appendix for the unicode library?
my prof told me it would be something like 'c'-'0' but I don't understand how that results in 'C'

could someone explain?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what the "unicode library" is, but the String and Character classes have toUpperCase() methods that you can use.

As for the arithmetic your prof is talking about, every character has a corresponding number (actually is a number, just interpreted a special way), and you can do math on those numerical values. And the numbers go in the same order as the letters, and increase by one with eacn subsequent letter, which is convenient sometimes, but shouldn't be relied on in an OO context, or when we might have to deal with more than just A-Z and a-z.

So, for instance, since 'G' comes 3 positions after 'D', we get 'G' - 'D' == 3. 'D' is 68 and G is 71, but those specific values don't matter here.

So, given that we have numbers for 'A'..'Z' and numbers for 'a'..'z', and even without knowing anything about what those numbers are or where the lowercase ones are in relation to the uppercase ones, it's just simple arithmetic to turn any lowercase to its corresponding uppercase, or vice-versa. I'll leave you to work out that last bit for yourself.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47261
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I shall make that easier by showing you a link to the first Unicode chart. Note Unicode use proper numbers (hexadecimal).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic