<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
The Inspect dialog does funny things when inspecting strings, even
though the contents are fine. If the actual output of the string is
giving you problems then try using an AnsiString.<br>
<br>
Phil.<br>
<br>
Allan, Samuel wrote:
<blockquote
 cite="mid9EA1E9775D329F4CB45B259FCA43F79F062D9798@its-xchg3.massey.ac.nz"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <title>Message</title>
  <meta content="MSHTML 6.00.2800.1522" name="GENERATOR">
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">We have a weird problem where we are
building a string up. It is quite a large string, but not exceptionally
large. About maybe 1000 characters. The code to create the string
approximates:</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">insertString, finalString: string;</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">for i := 0 to maxDataIndex do</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">&nbsp;&nbsp; insertString := insertString +
dataItem[i];</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">finalString := CONSTANT_A + insertString +
CONSTANT_B + insertString + CONSTANT_C;</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">Without throwing an overflow warning or any
other warning, this code results in a finalString where the first
instance of insertString is whole and complete. The second instance is
interrupted half-way by what looks like a random memory dump, and there
is no CONSTANT_C afterwards. insertString remains pristine and
untouched.</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">We have also tried several variations on
the above code:</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">Using Copy() to create two additional
strings, one for each insert. Same result for finalString, both
additional insert strings are fine.</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">Putting placeholder tokens in the
finalString, then running StringReplace(). Same result.</span></font></div>
  </span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">We tried to isolate the code in a separate
application. The separate application works fine, as you would expect.
So we think it may be something to do not with the code itself, but
with the structure of our application. However, code like this is
widely used within this application and elsewhere works fine.</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font><font color="#0000ff"
 face="Arial" size="2"><span class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">Our application implicitly compiles several
packages into itself. The code in question is in one of these packages.
So compiling any change to it requires compiling the package, then
compiling the application.</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font><font color="#0000ff"
 face="Arial" size="2"><span class="254273822-03112005"></span></font>&nbsp;</div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005">We have searched the web, and found an
exact match for this posted in some newsgroup in 1998, but there were
no responses. The match does not mention packages however.</span></font></div>
  <div><font color="#0000ff" face="Arial" size="2"><span
 class="254273822-03112005"></span></font>&nbsp;</div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Delphi mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Delphi@ns3.123.co.nz">Delphi@ns3.123.co.nz</a>
<a class="moz-txt-link-freetext" href="http://ns3.123.co.nz/mailman/listinfo/delphi">http://ns3.123.co.nz/mailman/listinfo/delphi</a>
  </pre>
</blockquote>
</body>
</html>