Re: Where is stringbuilder?



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)
.



Relevant Pages

  • Re: Is this string input function safe?
    ... return a pointer to mallocated memory holding one input string, ... See my comment after your call to fgets. ... char* malloc_getstr ... before any characters are read, then the ...
    (comp.lang.c)
  • Re: RfD: XCHAR wordset (for UTF-8 and alike)
    ... extended to work with xchars, ... >replacing one char with another. ... before-cursor part, even for fixed-width characters. ... So, should string words ...
    (comp.lang.forth)
  • RE: Fixed Length
    ... match these formats, but rather pull the existing, normal, formats from the ... and run a function to build that information into a string that you ... length and the total lenght of all the fields has to be 100 characters. ... JobId (8 char) ...
    (microsoft.public.access.modulesdaovba)
  • Re: Sorry, newbie question about generating a random string
    ... string grows to a max of 10 characters. ... The real problem is that you are not terminating the string. ... string is an array of characters ending in a null character, ... char myChar; ...
    (comp.lang.c.moderated)
  • Re: Is this code totaly a shit?
    ... | void UppStrg(char *Low, char *Upp, int cnt); ... whitespace-delimited string. ... You're also assuming that the representations of the characters ...
    (comp.lang.c)