请问:如何格式化 duoblue(双精度)型,使其只有小数点后4位
      如何将它转换为 String 型,又如何将 String 转换为小数点后4位的双精度型    如何在一个指定的字符串中找出给定字符的位置

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var i:double;
        j:string;
    begin
    i:=2.778899;
    j:=format('%.4f',[i]);
    showmessage(j);
    end;floattostr(i);
    strtofloat(i);
    Pos(' ', S)
      

  2.   

    var
     floatstr: string;
    floatstr:=formatfloat('#########.####',69853.6523652);//即可将双精度数69853.6523652转化为69853.6523的格式的字符串型数据要找到指定的字符 用pos 函数可以实现。你可用DELPHI的帮助看这个函数的实例
      

  3.   

    floattostr(roundto(23.2348992345,-4));
    roundto(strtofloat('23.2345767456'),-4);
      

  4.   

    pos 是可以找到第一个要找的字符,那有没有在指定字符串的第n个位置开始找字符的函数,vb中就有这样的函数.