Your function looks fine.  The only thing I can think of is perhaps the
compiler might be sign extending the char and if that is the case, then the
following code blanks out the high bits:

  Result := Char(CharLower(Pointer(Integer(Ch) and $FF)));

You might also like to try CharLowerBuff, as this has been designed
specifically for your purpose or lower casing parts of a string.

----- Original Message ----- 
From: "Ross Levis" <[EMAIL PROTECTED]>


Some clients are receiving the above message in my app.
A google search finds the exact same message/address in other applications
but doesn't offer a solution.  It could be related to this function.  Can
anyone see anything wrong with this.

function LCase(Ch: Char): Char;
begin
  Result := Char(CharLower(Pointer(Ch)));
end;

CharLower accepts an ascii character or an address of a string (pChar).  The
Delphi compiler only recognises a pChar for the parameter and doesn't accept
a character, so Pointer(Ch) gets around this.  It works fine here during
testing, but it's something I modified recently so I thought I had better
check it out with you experts.

I'm doing this to lowercase portions of a string, and CharLower takes into
account the windows locale for foreign languages.

Thanks,
Ross.


----------------------------------------------------------------------------
----


> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to