# Using the unicode library

Jessica Benady

Greenhorn

Posts: 8

posted 3 years ago

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

So, for instance, since 'G' comes 3 positions after 'D', we get

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.

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

Posts: 50258

79

posted 3 years ago

I shall make that easier by showing you a link to the first Unicode chart. Note Unicode use

**proper**numbers (hexadecimal).