解决方案 »

  1.   

    这么写就行
    edit2.Text :=inttostr(ord('g'));
    这么写就不行?
    edit2.Text :=inttostr(ord(edit2.text));
      

  2.   

    不管是什么,我还没运行呢,语法检查时就提示edit2.text是不正确的类型,但都是字符串啊???
      

  3.   

    我要传递字符串变量给ord就不行了呀
      

  4.   

    不会吧,en我用的是byte()
    procedure TForm1.Button1Click(Sender: TObject);
    var
    str:widestring;
    s:string;
    flag1,qu,wei,i,j:integer;
    begin
    str:=edit1.Text;
    for i:=1 to length(str) do
    begin
    s:=str[i];
    if length(s)>1 then
    begin
    j:=word(s[1]) shl 8 + WORD(s[2]);
    If (j > 31) And (j < 127) Then
    begin
      qu := 161;
      wei := j + 161 * 2 - 6;
    end
    Else
    begin
      qu :=j div 256;
      wei:=j-(j div 256)*256;
    End;
    flag1:= 94 * qu + wei;
    flag1:= flag1 - 95 * 161;
    end
    else
    begin
    j:=byte(str[i]);
    end;
    end;
    end;
      

  5.   

    传递的应该是字符不是字符串,edit1.text的值是字符串