Q&A

  • 콤마가 찍힌 문자열을 float형식으로 받아오려면...
panel1.caption:=formatfloat('#,##0',strtofloat(s));



여기서 panel1에 들어간 값을 다시 float형으로 받으려면 어떻게 하면 되겠습니까? 콤마가 없어야 형변환을 할 수 있을텐데요.

1  COMMENTS
  • Profile
    최석기 1999.06.26 17:37
    박성훈 께서 말씀하시기를...

    > panel1.caption:=formatfloat('#,##0',strtofloat(s));

    >

    > 여기서 panel1에 들어간 값을 다시 float형으로 받으려면 어떻게 하면 되겠습니까? 콤마가 없어야 형변환을 할 수 있을텐데요.



    글쎄요..

    그런 함수 같은게 있는지는 잘 모르겠구요..

    전 다음과 같은 함수를 만들어서 ','를 제거하고 변환을 시키거든요..



    function SearchAndReplace(sSrc, sLookFor, sReplaceWith: string ): string;

    var

    nPos,

    nLenLookFor : integer;

    begin

    nPos := Pos(sLookFor, sSrc);

    nLenLookFor := Length(sLookFor);

    while(nPos > 0)do

    begin

    Delete( sSrc, nPos, nLenLookFor );

    Insert( sReplaceWith, sSrc, nPos );

    nPos := Pos( sLookFor, sSrc );

    end;

    Result := sSrc;

    end;