Sign in Join
FPDoc Onlineexperiment

ReadStr procedure

In unit System

Read variables from a string.

Declaration

pascal
procedure ReadStr(const S: string; Args: Arguments)

Description

ReadStr behaves like Read, except that it reads its input from the string variable S instead of a file. Semantically, the ReadStr call is equivalent to writing the string to a file using the Write call, and then reading them into the various arguments Arg using the Read call from the same file:

var
  F : Text;
begin
  Rewrite(F);
  Write(F,S);
  Close(F);
  Reset(F);
  Read(F,Args);
  Close(F);
end;

Obviously, the ReadStr call does not use a temporary file.

ReadStr is defined in the ISO Extended Pascal standard. More information on the allowed arguments and the behaviour of the arguments can be found in the description of Read.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.