System.Classes.TReader.ReadString
Delphi
function ReadString: string;
C++
System::UnicodeString __fastcall ReadString();
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.Classes.pas System.Classes.hpp |
System.Classes | TReader |
Description
Reads and returns a string from the reader object's stream.
ReadString is a helper method used by other reader methods to read a tagged string type value at the current reader Position. ReadString calls ReadValue to read the value-type indicator. If the value-type indicator is vaString
, vaLString
, vaWString
, or vaUTF8String
, then ReadString calls Read to read the string of the indicated type and returns the retrieved value in the String type. Otherwise, the EReadError exception is raised.
ReadString advances the reader Position after the last byte it has read.
Warning: Always use ReadString for reading strings from streams. Compare with ReadStr.
Note: Please note that the
vaString
value type indicator applies to the ANSIString
type, while the vaLString
value type is for the Unicode string type, which is the alias of the string type.