本文介绍了从字符串更改为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每个人我都需要某种方式来更改delphi 7中的整数和字符串
EveryOne I need some esay way to change from integer and string in delphi 7
var
Str:String;
Int:Integer;
// Here what i need to do
Str:='123';
Int:=Str.AsInteger
// or use this
Int:=123;
Str=Int.AsString;
推荐答案
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
end;
Integer = class
FValue: System.Integer;
function ToString: string;
public
property Value: System.Integer read FValue write FValue;
end;
var
Form1: TForm1;
implementation
function Integer.ToString: string;
begin
Str(FValue, Result);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Int:integer;
begin
Int.Value:=45;
Edit1.Text:=Int.ToString;
end;
end
这篇关于从字符串更改为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!