- Current version
- Download uSandkasten.zip (15KB), Delphi 5 source code.
- Collection of Delphi (I am using Version 5) routines
- uSandkasten is freeware that comes without any warranty or support. Thus you use it at your own risk. You may even use it in commercial products as long as you don’t charge your customers for the added value.
- Not all routines are written by myself. Credit is given in the source file where it is due.
Important note: The current version fixes a bug in TGetOpt when treating long options that have short equivalences. And another one when creating TLogFileStreams and truncating files.
No installation needed: Just copy the units to your Delphi library directories or into your project directory. I recommend using a dedicated directory for the Sandkasten, though. You’ll have to add the path to it to Delpih’s or your project’s library paths.
Note: I split the unit up into several pieces. The reasoning behind this was that I wrote a console application where I didn’t want to have the forms and comctrls units. If you need specific parts, just use the
uSandkastenBasefor basic routines without user interface stuff. Like the GNU-getopt-like command line parsing class TGetopt.
uSandkastenGUIfor routines requiring the units
uSandkastenNetfor routines requiring
Or just use
uSandkasten which combines all of them, if you’re in a large project with all those units anyway.
These are the routines that are implemented in my uSandkasten, grouped by their appearance in the various sub-units.
CreateTempfile: The recommended way to create a temporary file
UnescapeString: Encode and unencode strings like you know it from Unix (\a, \b, \t, \n, \v, \f, \r, \\ and \xXX (hex notation))
ExpressStringParthandles strings that are separated by a specific character or string and returns a given part
GetBuildInforetrieves the version numbers from a file
HTMLEntityEncodehandles potentially dangerous (for HTML) characters
LanguageNameFromCodelooks into the registry and returns the local name of the language determined by an ISO shortcut (en -> English)
StrToNumber: Convert numbers from/to any number system with a basis from 1 to 36. Thanks to Christian
RandomPassword: create easily rememberable passwords. This is the same algorithm as shown on my randompassword web site.
WinExecAndWait32: Execute a program and wait for its return. A routine that improves some routines that I found on the internet.
TLogFileStream: file stream to create log files without buffering
- German variants to convert numbers into words: 10 → zehn
RearMatch: checks, if a string ends with a given substring
TGetOptimplements a getopt variant for Delphi. It is nearly POSIX compatible, supporting long options, required, optional and no arguments
ColorLightness: Get lightness of colour
- Set and Load RTF source for/from a TRichEdit
HexStrToColor: convert TColor into a hex representation of it and vice versa
ShowMyMessage: Replacement for ShowMessage: Without using dialogs.pas
MyMessageBox: Replacement for MessageBox: Accepts strings and has MB_APPLMODAL or MB_TASKMODAL as default setting. The reason I use this is GNU gettext and the problems when having PChars for that.