varString
varString = 256
Example
function HasPascalByteString(const Value: Variant): Boolean;
begin
Result := (VarType(Value) and varTypeMask) = varString;
end;
Usage
varString identifies a Velox-managed RawByteString Variant that is reference-counted and explicitly not OLE Automation compatible.
Additional Technical Info
varString is the base TVarType code $0100 for Delphi-managed RawByteString/legacy ANSI string storage. It is reference-counted and explicitly not OLE Automation compatible.
On the current Unicode Delphi target, an ordinary script String Variant normally uses varUString. varString can still arrive from ANSI/native libraries, older data paths or explicit RawByteString values.
Encoding and ownership
- The payload is bytes plus Delphi string metadata/code-page context. It is not automatically UTF-8 and is not safe to treat as opaque binary when text conversion may occur.
- Conversion to
varUStringorvarOleStrdecodes and allocates; a wrong/missing source code page can corrupt characters. - Assignment shares managed storage until copy-on-write behavior requires a new buffer; clearing releases a reference.
- A
varByRefform borrows an external string slot and has separate lifetime risk.
Delphi VarArrayCreate rejects varString as a fixed Automation array element. Use varOleStr for a string SAFEARRAY or varVariant elements when mixed Variant strings are required.
VarAsType can request the base tag for a supported conversion, but do so only with a governed encoding. VarType performs no decoding.
The example is source-reviewed only; no string was converted or copied.
External references
Created 2026-07-15