Is all this Invarient **** er... stuff, premature optimisation?

Ary Borenszweig ary at esperanto.org.ar
Mon Apr 28 18:02:15 PDT 2008


Walter Bright escribió:
> Steven Schveighoffer wrote:
>> Java's String.substring(start, last) works just like slicing...
> 
> No it doesn't. It makes a copy (I don't know if this is true of *all* 
> versions of Java).

A String holds an char[], the "start" in it and it's "length". A 
substring just creates another String instance with "start" and "length" 
changed.

So it makes a new String, but the underlying char[] remains the same.



More information about the Digitalmars-d mailing list