<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
</head>
<body>
<p style="margin: 0;">
<span>
<span></span>
</span>
</p>
<p style="margin: 0px;"> </p>
<div style="margin: 5px 0px 5px 0px;">
<br/>
Hans-Peter Diettrich <DrDiettrich1@aol.com> hat am 17. November 2011 um 09:33 geschrieben:
<br/>
<br/>
> In forms.IsAccel I suspect an bug, which manifests in very rare cases only:
<br/>
>
<br/>
> position := UTF8Pos(AmpersandChar, ACaption);
<br/>
> This is the position of the &
<br/>
>
<br/>
> ...
<br/>
>
<br/>
> UTF8Delete(ACaption, 1, position+1);
<br/>
>
<br/>
> This IMO removes the character *after* the ampersand
</div>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;">Yes, which is another ampersand (&&). So it deletes both ampersands. </p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"> </p>
<div style="margin: 5px 0px 5px 0px;">
>, so that>
<br/>
> position := UTF8Pos(AmpersandChar, ACaption);
<br/>
>
<br/>
> finds the same & over and over again, while it should find the next one.
</div>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;">Have you tested it? It looks correct to me. </p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"> </p>
<div style="margin: 5px 0px 5px 0px;">
>
<br/>
>
<br/>
> Now for some questionable constructs:
<br/>
>
<br/>
> A simple Pos would be sufficient, because '&' is an ASCII character.
</div>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;">Yes. The whole UTF8 in there unneeded, except for the comparison of the one character with the VK. </p>
<p style="margin: 0px;"> </p>
<div style="margin: 5px 0px 5px 0px;">
>
<br/>
> It would be sufficient to replace the found '&' by something else, in place.
</div>
<div style="margin: 5px 0px 5px 0px;">
>
<br/>
> Or a loop until the last char could be used, which eliminates any string
<br/>
> time and memory consuming string manipulation.
</div>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;">Feel free to provide a patch.</p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;"> </p>
<p style="margin: 0px;">Mattias</p>
<p style="margin: 0px;"> </p>
</body>
</html>