在存的时候就是按¥100存,
如:
s:='¥100';      //其中S有时为'¥100',有时为'100'
f:=strtocurr(s)时出错!

解决方案 »

  1.   

    看我的:count:integer;
    s:string;
    f:currencys:='¥100';
    count:=length(s);
    s:=copy(s,3,count-1);//注意 3
    f:=strtocurr(s);
      

  2.   

    用pos来判断“¥”是否存在,if Pos(Substr: string; S: string)>0 then....
    存在则用delete切去
    再用strtocurr  or strtofloat来转换
      

  3.   

    好象应该是从2开始吧?一个人民币符号占两位的话,好象应该是:s:=copy(s,2,count-1);
      

  4.   

    试试下面的函数:
    function ChangetoCurr(Str : String) : string;
    var
      f:currency;
    begin
      Str:=copy(Str,3,length(Str)-1);
      f:=strtocurr(Str);
      Result := FormatCurr('00.00',f);
    end;调用:
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      caption := ChangetoCurr('¥100');
    end;