I try to convert some code from D2007 to XE5 and got
E2010 Incompatible types: \'AnsiChar\' and \'Char\'
from this code
TSetOfChar = Set of Cha
uses
..., AnsiStrings;
type
TSetOfChar = Set of AnsiChar;
var
CharacterSet: TSetOfChar;
s: AnsiString;
for j := 1 to Length(s) do
begin
Include(CharacterSet, s[j])
if not CaseSensitive then
begin
Include(CharacterSet, AnsiStrings.AnsiUpperCase(s[j])[1]);
Include(CharacterSet, AnsiStrings.AnsiLowerCase(s[j])[1]);
end
end;
Alternatively:
uses
..., AnsiStrings;
type
TSetOfChar = Set of AnsiChar;
var
CharacterSet: TSetOfChar;
s, s2: AnsiString;
if CaseSensitive then
begin
for j := 1 to Length(s) do
Include(CharacterSet, s[j]);
end else
begin
s2 := AnsiStrings.AnsiUpperCase(s);
for j := 1 to Length(s2) do
Include(CharacterSet, s2[j]);
s2 := AnsiStrings.AnsiLowerCase(s);
for j := 1 to Length(s2) do
Include(CharacterSet, s2[j]);
end
end;