DelphiFAQ Home Search:
General :: Programming :: Delphi :: Strings
Algorithms for string handling problems, implemented in Delphi but useful for any procedural language.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

A tricky way to use SetLength()

Several Windows API functions that retrieve a string get a PChar as an argument and return the number of bytes retrieved. This return value can be used for SetLength().

An example for that is the function GetWindowsDirectory() that is used in the following piece of code:

 function GetWindowsDir: string;
   SetLength(Result, MAX_PATH);
   SetLength(Result, GetWindowsDirectory(PChar(Result), Length(Result)));
You don't like the formatting? Check out SourceCoder then!
Generated 8:01:09 on Dec 8, 2019