Re: How to check variables for uniqueness ?
- From: Mark Thornton <mark.p.thornton@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 16 Jan 2007 21:25:32 GMT
Chris Uppal wrote:
It depends on what you mean. String.length() returns, correctly, the number of
Java "char"s in the String. No problem there. What /is/ a problem is that
that is not the same as the number of characters in the Unicode text. That's a
problem caused by the mis-specification of Java's chars to be 16-bit
quantities. It is highly unfortunate, but there is very little that can be
done about it now. It means that correct programming is more difficult than it
When UNICODE was first proposed it was expected that 16 bits would be enough. The designers of Java believed them. I'm not sure of the exact timing of Unicode's extension beyond 16 bits relative to Java's development. Even if Gosling et al had known that Unicode would grow beyond 16 bits, it might still have been correct to use 16 bits for Java characters. Even as it was there was a fair bit of muttering about the space used by these wide characters.
As for case mapping, it worth noting that The Windows NTFS file system uses a special case mapping which doesn't correspond to that of any known locale. I wonder how much software exists which compares file names using regular string comparison.
Mark Thornton
.
- Follow-Ups:
- Re: How to check variables for uniqueness ?
- From: Chris Uppal
- Re: How to check variables for uniqueness ?
- References:
- Re: How to check variables for uniqueness ?
- From: John Ersatznom
- Re: How to check variables for uniqueness ?
- From: Oliver Wong
- Re: How to check variables for uniqueness ?
- From: John Ersatznom
- Re: How to check variables for uniqueness ?
- From: Oliver Wong
- Re: How to check variables for uniqueness ?
- From: John Ersatznom
- Re: How to check variables for uniqueness ?
- From: Lew
- Re: How to check variables for uniqueness ?
- From: John Ersatznom
- Re: How to check variables for uniqueness ?
- From: Chris Uppal
- Re: How to check variables for uniqueness ?
- From: John Ersatznom
- Re: How to check variables for uniqueness ?
- From: Chris Uppal
- Re: How to check variables for uniqueness ?
- Prev by Date: Accessing attributes in HTML with DOM
- Next by Date: Re: [Algorithm] Sum of Primes < 1000000
- Previous by thread: Re: How to check variables for uniqueness ?
- Next by thread: Re: How to check variables for uniqueness ?
- Index(es):
Relevant Pages
|