var sss:string;okok:integer; 
begin 
sss:='X'; 
okok:=ord(sss);
end;运行时为什么提示类型不对呢?

解决方案 »

  1.   

    var sss:string;okok:integer; 
    begin
    sss:='X';
    okok:=ord(sss[1]);
    showmessage(inttostr(okok))
    end;
      

  2.   

    Delphi syntax:function Ord(X);DescriptionX is a Delphi ordinal-type expression. The result is the ordinal position of X; its type is the smallest standard integer type that can hold all values of X's type.Ord cannot operate on Int64 values.
    x要是一种序列型的表达式。
    就像在case语句中一样。。也不可以用string做为参数的
      

  3.   

    不是字符串是字符
    比如:var sss:String;okok:integer;
    begin
      sss:='X';
      okok:=ord(sss[1]);
    end;