Re: Where is stringbuilder?



On Fri, 20 Oct 2006 09:32:49 +0200, "Maarten Wiltink"
<maarten@xxxxxxxxxxxxxxxxxx> wrote:

"Rob Kennedy" <me3@xxxxxxxxxxx> wrote in message
news:4pr1kqFk8t34U1@xxxxxxxxxxxxxxxxx
J French wrote:

What an odd idea
A string is just a block of memory

In Win32 Delphi, yes. In Java and .Net, no. In those, a string is an
object. If it had methods that could change its contents, then anything
that stored a reference to a string would be in danger of having that
string change later.

There is that. Plus, a string does not contain amorphous bytes but
*characters*. These may be two bytes in length. Or one-or-more bytes.
They may be encoded in US-ASCII, with high bits implicitly cleared
because they're not used anyway. Or in ISO-8859-1. Or ISO-8859-15,
or Windows-1252. Or KOI-8. UTF-8. UTF-7. EBCDIC.

I'm not sure about this, but my understanding is that Delphi treats a
String as an array of Bytes unless one uses the ANSI prefixed routines
which might treat some combinations of two bytes as one Char if one is
in a MBCS locale

Is there ever a case where Length( S[n] ) = 2 ?


.



Relevant Pages

  • Re: Where is stringbuilder?
    ... In Win32 Delphi, this statement is easy: ... cannot change the contents of the old string, even when the reference count is 1. ... Since Mid is a compiler built-in function, it could probably be implemented the same way I expanded the Delphi assignment statement above. ... If it had methods that could change its contents, then anything that stored a reference to a string would be in danger of having that string change later. ...
    (alt.comp.lang.borland-delphi)
  • Re: Where is stringbuilder?
    ... A string is just a block of memory ... In Java and .Net, no. ... string change later. ...
    (alt.comp.lang.borland-delphi)
  • Re: Help me!! Why java is so popular
    ... String or StringBuffer? ... keep in mind I knew NOTHING about Java. ... The language accepted it, no warnings, and thus I ... in some native assemblers you can peruse the instruction ...
    (comp.lang.java.programmer)
  • Re: question about assigning null to a reference object
    ... String getAuthor() ... void setAuthor ... b.setTitle("Thinking in Java 4th Edition"); ...
    (comp.lang.java.help)
  • Re: Java questions: Urgent
    ... why I would expect almost any Java programmer to be able to answer ... Which is the main reason I "butted" in a bit.. ... on the characters in the String. ... > therefore naturally cover all the basics, or they have missed out badly ...
    (comp.lang.java.programmer)