How to split a string and get values from the string? lazarus / 61-Beginners ---------------------------------------------------------------------- Doe · 2021-01-24 11:55 Hello, guys. I was trying to split a text in a memo, for example, "distance = 10" or "distance=10". The string should be split by "=" or " =" and get the value behind it, but my code doesn't assign the value to the related variables. How to solve this problem. My codes are below: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  Form1: TForm1;  i:integer;  A: TStringArray;  toxt: string;  dist,time:string; procedure TForm1.Button1Click(Sender: TObject);begin    for i:=0 to memo1.lines.count-1 do    begin       text:=memo1.lines[i];       If (Pos(' = ',toxt)>0) then       begin     A := toxt.Split(' = ');       if (A[0]='distance') then       begin       dist:=A[3];       end       else if A[0]='time' then     begin       time:=A[3];       end       else       if (Pos(' = ',toxt)=0) then       begin       A := toxt.Split('=');       if A[0]='distance' then       begin       dist:=A[3];       end       else if A[0]='time' then       begin       time:=A[3];       end     end;    end;end;    showmessage(dist);    showmessage(time);end;end. ---------------------------------------------------------------------- PascalDragon · 2021-01-24 12:01 Please use code tags to avoid the forum software messing up your code. ---------------------------------------------------------------------- wp · 2021-01-24 12:09 The Lines propety of a memo is a descendant of TStrings and thus inherits the handling of name=value pairs implemented by TStrings. Simply use the Values[name] property which returns the value part after the '=': Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  distance: Double;  time: Double;  h: Double;begin  distance := StrToFloat(Memo1.Lines.Values['distance']);  time := StrToFloat(Memo1.Lines.Values['time']);  h := StrToFloat(Memo1.Lines.Values['height']); ---------------------------------------------------------------------- Doe · 2021-01-24 12:13 Thanks a lot! ---------------------------------------------------------------------- Bart · 2021-01-24 19:30 IIRC then you asked the same question a few days ago. Bart