From https://stefan.huberdoc.at/en/sandkasten-useful-routines-for-delphi-programmes/
Collection of Delphi (I am using Version 5) routines by Stefan Kügler (né Huber)
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 subunits:
uSandkastenBasefor basic routines without user interface stuff. Like the GNU-getopt-like command line parsing class TGetopt.uSandkastenGUIfor routines requiring the units forms and comctrls.uSandkastenNetfor routines requiring winsock.
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 fileDigitStrToDigitWordsEscapeStringandUnescapeString: 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 partGetBuildInforetrieves the version numbers from a fileGetComputerNameGetEnvironmentStringHTMLEntityDecodeandHTMLEntityEncodehandles potentially dangerous (for HTML) charactersLanguageNameFromCodelooks into the registry and returns the local name of the language determined by an ISO shortcut (en -> English)NumberToStr,StrToNumber: Convert numbers from/to any number system with a basis from 1 to 36. Thanks to Christian Nineberry Schwarz.UrlEncode,UrlDecodeRandomPassword: create easily rememberable passwords. This is the same algorithm as shown on my randompassword web site.StringToStreamandStreamToStringWinExecAndWait32: 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 substringTGetOptimplements 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 ColorToHexStrandHexStrToColor: convert TColor into a hex representation of it and vice versaColorToHSVandHSVToColorShowMyMessage: Replacement forShowMessage: Without using dialogs.pasMyMessageBox: Replacement for MessageBox: Accepts strings and hasMB_APPLMODALorMB_TASKMODALas default setting. The reason I use this is GNU gettext and the problems when having PChars for that.
- easy
getHostByNameandgetHostByAddr