22 January 2007 - java_dev (original) (raw)

11:46 pm - banana - String gotchas How long is a string? How do I tell if one string is equal to another?I thought I knew the answers to these questions, but it turns out to be more complex than I thought.But I should have known: I knew that a char isn't big enough for a Unicode character, and I could even remember the lovely phrase "astral planes". So I knew there was a problem with strings in Java.Anyway, read the various answers to the two string questions at http://java.sun.com/mailers/techtips/corejava/2006/tt0822.html (and Tim Bray's explanation of why a char isn't big enough for a Unicode character at http://www.tbray.org/ongoing/When/200x/2003/04/26/UTF ) and then go and re-write lots of code.