Jesper Stenlund wrote:
> I'm about to upgrade to D2009 and I'm running into some troubles regarding 
> char and AnsiChar.
> 
> I have a function that checks if a char is in uppercase or lowercase.
> 
> The declaration looks like this:
> 
>     function CharIsUpper(c: char): boolean;
> 
> and the call to the function looks like this:
> 
>     if CharIsUpper(myString[i]) then
> 
> 
> But when I try to compile it in Delphi 2009 I get this errormessage at the 
> callingpoint:
> "E2010 Incompatible types: 'AnsiChar' and 'Char'"

You forgot to show the declaration of your variable.

I imagine it's declared as an AnsiString. Why?

> What's the best to do for me if I want the function to act in D2009 
> exactly as it did in D2006?

If you want everything to work exactly as it did in Delphi 2006, then 
use Delphi 2006. Delphi 2009 uses Unicode.

> Should I change the declaration to look like this?
> 
>     function CharIsUpper(c: WideChar): boolean;
> 
> or is it a better way around the problem?

You'll probably have to re-implement the function anyway since there are 
many, many more uppercase characters in Unicode than there are in any 
Ansi code page.

In fact, it was my understanding that Delphi would include several 
functions for classifying characters based on their Unicode properties.

-- 
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to