从Web获取变量值

时间:2011-11-22 10:04:36

标签: delphi

加载来自网络的文字就像 value1 = 1,value2 = 2,value3 = 3 bla bla bla

我实际上想获得声明变量的值是否可能?

//loaded from web address 
value1=1,value2=2,value3=3

Procedure getvarvaules;
var
value1:string  ='1';
value2:string  ='2';
value3:string  ='3';
begin
end;

1 个答案:

答案 0 :(得分:4)

使用TStringList:

var
  lst: TStringList;
begin
  lst := TStringList.Create;
  try
    lst.Commatext := { variable containing the webresult };
    value1 := lst.Values['value1'];
    value2 := lst.Values['value2'];
    value3 := lst.Values['value3'];
  finally
    lst.Free;
  end;
end;