O que há de errado com essa função?
Pessoal, uso o delphi 2010 e essa função apresenta o seguinte erro, alguém poderia me ajudar a resolver este problema? Desde já, grato a todos!
function FastUpperCase(const s: String): string;
{Fast uppercase}
var
I: Integer;
C: Char;
begin
Result := S;
I := Length(Result);
while I > 0 do
begin
C := Result[I];
if C in [#97..#122] then
Dec(Byte(Result[I]), 32); //o erro é nessa linha
Dec(I);
end;
end;
a mensagem de erro é: [Error] ifps3utl.pas(549): E2064 Left side cannot be assigned to
já com esse outro trecho de código tenho o seguinte erro:
function CheckReserved(Const S: ShortString; var CurrTokenId: TIfPasToken): Boolean;
var
L, H, I: LongInt;
J: Char;
SName: ShortString;
begin
L := 0;
J := S[0];
o erro apresentado é esse: [Error] ifps3utl.pas(655): E2010 Incompatible types: 'Char' and 'AnsiChar'
function FastUpperCase(const s: String): string;
{Fast uppercase}
var
I: Integer;
C: Char;
begin
Result := S;
I := Length(Result);
while I > 0 do
begin
C := Result[I];
if C in [#97..#122] then
Dec(Byte(Result[I]), 32); //o erro é nessa linha
Dec(I);
end;
end;
a mensagem de erro é: [Error] ifps3utl.pas(549): E2064 Left side cannot be assigned to
já com esse outro trecho de código tenho o seguinte erro:
function CheckReserved(Const S: ShortString; var CurrTokenId: TIfPasToken): Boolean;
var
L, H, I: LongInt;
J: Char;
SName: ShortString;
begin
L := 0;
J := S[0];
o erro apresentado é esse: [Error] ifps3utl.pas(655): E2010 Incompatible types: 'Char' and 'AnsiChar'
Ivan Alves
Curtidas 0
Respostas
Andre Santos
26/12/2013
a mensagem de erro é: [Error] ifps3utl.pas(549): E2064 Left side cannot be assigned to
veja se isso resolve :
SetLength(variavel,10)
o erro apresentado é esse: [Error] ifps3utl.pas(655): E2010 Incompatible types: 'Char' and 'AnsiChar'
Este é simples: aponte para sua variavel definindo o tipo ex: (Char(minhaVariavel)) , ou (AnsiChar(minhaVariavel)) dependendo de onde for chama-la crie uma outra variavel
deste jeito indicado ex: outraVariavel : Char; outraVariavel := Char(minhaVariavel)
GOSTEI 0