How to correctly compute the length of a String in Java?
The normal model of Java string length String.length() is specified as returning the number of char values (“code units”) in the String. That is the most generally useful definition of the length of a Java String; see below. Your description1 of the semantics of length based on the size of the backing array/array slice is … Read more