Re: Where is stringbuilder?
- From: erewhon@xxxxxxxxxx (J French)
- Date: Fri, 20 Oct 2006 11:50:24 GMT
On Fri, 20 Oct 2006 13:36:38 +0200, "Maarten Wiltink"
<maarten@xxxxxxxxxxxxxxxxxx> wrote:
"J French" <erewhon@xxxxxxxxxx> wrote in message
news:45388471.503443109@xxxxxxxxxxxxxxxxxxx
[...]
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
You're right that it doesn't matter to the _language_. It's the
libraries where the difference starts to matter, mostly.
But the biggest problem (as usual) is in keeping things straight in
people's heads. I try to write _correct_ code and to encourage others
to do so. That requires, for example, being aware of the difference
between a string of 2-byte Unicode (UCS-2) characters, a string of
1-byte windows-1252 (not the same as either ISO-8859-1 or US-ASCII,
but close) characters, and a stream of bytes that encodes in UTF-8
either of those strings.
Is there ever a case where Length( S[n] ) = 2 ?
No. A character is a character even if it's a WideChar.
SizeOf(S[n]) might, though.
Slap ! SizeOf()
- would it really ?
- that would mean that a Char by Char copy of one string to another
could result in a significant crunch
I'm not sure now, but quite some time ago I convinced myself that
'pure' Delphi operated Byte by Byte and that the MBCS stuff only
turned up when you used the Windows APIs or used Delphi constructs
that do the same.
- Both of which I avoid like the plague
Is it actually possible in Delphi, for the number of Bytes in a string
to be different from its Length() ?
(obviously not WideString stuff)
.
- Follow-Ups:
- Re: Where is stringbuilder?
- From: Rob Kennedy
- Re: Where is stringbuilder?
- References:
- Where is stringbuilder?
- From: brett
- Re: Where is stringbuilder?
- From: Rob Kennedy
- Re: Where is stringbuilder?
- From: J French
- Re: Where is stringbuilder?
- From: Rob Kennedy
- Re: Where is stringbuilder?
- From: J French
- Re: Where is stringbuilder?
- From: Rob Kennedy
- Re: Where is stringbuilder?
- From: Maarten Wiltink
- Re: Where is stringbuilder?
- From: J French
- Re: Where is stringbuilder?
- From: Maarten Wiltink
- Where is stringbuilder?
- Prev by Date: Re: Where is stringbuilder?
- Next by Date: Re: Where is stringbuilder?
- Previous by thread: Re: Where is stringbuilder?
- Next by thread: Re: Where is stringbuilder?
- Index(es):
Relevant Pages
|