Delphi에서str 함수 사용법

1190 단어
delphi F1       
Delphi syntax:
procedure Str(X [: Width [: Decimals ]]; var S);
Description
In Delphi code, Str converts X to a string representation according to the Width and Decimals formatting parameters. The effect is like a call to Write except the resulting string is stored in S instead of being written to a text file.
X is an integer-type or real-type expression. Width and Decimals are integer-type expressions. S is a string-type variable or a zero-based character array variable if extended syntax is enabled.
F1    
function MakeItAString(I: Longint): string;
{ Convert any integer type to a string }
var
  S: string[11];
begin
  Str(I, S);
  Result:= S;
end;
begin
  Canvas.TextOut(10, 10, MakeItAString(-5322));
end;
     ,          :
Str                    ,  Str(7,S),  ,S    '7 ',     ,    Str      ,    Str(S3,8,2)    S3       2 ,         ,       8      ,                ,  : 
Str(165.345:4:2,S), S   '165.35 ' 
Str(165.345:5:1,S), S   '   165.3 ',             ,          。
  :http://zhidao.baidu.com/link?url=MxmBEPodOzDA1eXIRRyHzMWP1HztLT0guQcCUmKanstypInRjLqcStiG8U6tDcsh0VLJZw0o-K0kv8bf3Y47C_

좋은 웹페이지 즐겨찾기