I’ve this question come up a few times, so …
Since Delphi 2009 you have probably noticed this warning: “[DCC Warning] Unit1.pas(27): W1050 WideChar reduced to byte char in set expressions. Consider using ‘CharInSet’ function in ‘SysUtils’ unit.” which suggests you to use the CharInSet function instead. CharInSet still requires a simple set of AnsiChars and fails (returns false) is the code of the passed character is greater than 255 which makes it useless for Unicode characters.
Putting it simple: replacing the “a in b” statement with CharInSet(a, b) will simply silence the compiler. Nothing more.
You should really consider using Character unit if you want to check whether a character is a letter, digit or is a part of another “standard set of chars”.
Take this example:
if C in [‘A’..’Z’] then // <-- OLD WAY WriteLn('The character is an upper-cased letter.'); if IsUpper(C) then // <-- UNICODE WAY WriteLn('The character is an upper-cased letter.'); end; [/sourcecode]