With a series of helper, Delphi can also use the chain CodeNow.
// For example, to extract 3.1415926 from 141 into an integer: var num: integer; begin num: = pi. tostring (). split (['. ']) [1]. substring (0, 3 ). tointeger (); // input. remember to use Ctrl + space to prompt the code showmessage (Num. tostring (); // 141end;
I'm writing something similar to the following:ProgramStart to use:
{The program requires extracting A: B :... the following text goes to the specified variable: A: qwertyuiopb: wertyuiopac: ertyuiopasqwertyuiopasdd: rtyuiopasd ...} uses system. character; // 2) and STR [2]. isinarray ([':']) then begin case STR [1] of 'A': A: = Str. substring (2 ). trim; // The chained code 'B': B: = STR is used here. substring (2 ). trim; 'C': C: = Str. substring (2 ). trim; 'D': D: = Str. substring (2 ). trim; end; List. free; showmessagefmt ('% s; % s', [a, B, c, d]); end;