JCL Help:StrResetLength@AnsiString
JCL Help: StrResetLength Function
Search in JCL Help
Search in all projects
Summary
Resets the length of the supplied string.
Pascal
procedure StrResetLength(var S: WideString); overload;
procedure StrResetLength(var S: AnsiString); overload;
procedure StrResetLength(S: TJclStringBuilder); overload;
procedure StrResetLength(var S: UnicodeString); overload;
Parameters
Parameters | Description |
var S: WideString | The string whose length to reset. |
Description
StrResetLength resets the length of the string to encompass only the actual number of used characters. This is particularly useful when passing strings to API functions which accept PChar's. These kind of functions do modify the string but since they are unaware of how Delphi manages strings, the length is not changed on return. Depending on how you use the string from that point on the results may be incorrect if you do not apply StrResetLength. The function resets the length to the C string length, i. e. the length up to the first #0 byte.
About
Unit
Donator
Marcel van Brakel
Contribute to this help topic
This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page