Delphi’s holy source of knowledge!

  • How can I use System.Devices in Delphi

    The System.Devices unit in Delphi provides classes and functions for working with device-related information, such as device names, device paths, and device capabilities. Here is an example of how you can use the TDeviceInfo class from the System.Devices unit to get information about a device uses System.Devices; var DeviceInfo: TDeviceInfo; begin DeviceInfo := TDeviceInfo.Create; try…

  • How can I use System.Hash in Delphi

    To use the System.Hash unit in Delphi, you will need to include the unit in your project by adding System.Hash to the uses clause in the implementation section of your code. Here is an example of how you can use the THashMD5 class from the System.Hash unit to calculate the MD5 hash of a string:…

  • How can I use System.Generics in Delphi

    In Delphi, you can use the Generics.Collections unit to work with generic collections. This unit provides several generic collection classes that you can use in your code, such as TListT, TOrderedListT, and TDictionaryTKey,TValue. Here is an example of how you can use the TListT class to create a list of integers: uses Generics.Collections; var List:…

  • How can I use System.JSON in Delphi

    To use the System.JSON unit in Delphi, you will need to include it in the uses clause of your project. Here is an example of how you can use the System.JSON unit to parse a JSON string and access its values: uses System.JSON; procedure Example; var JSONValue: TJSONValue; JSONObject: TJSONObject; JSONArray: TJSONArray; I: Integer; begin…

  • How can I check a valid email address in Delphi

    Here is a function that you can use to check whether a given string is a valid email address in Delphi: function IsValidEmail(const Email: string): Boolean; var EmailRegex: TRegEx; begin EmailRegex := TRegEx.Create(‘^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$’); Result := EmailRegex.IsMatch(Email); end; This function uses a regular expression to validate the email address. The regular expression checks for the following…

  • How can I convert TColor to html-color in Delphi

    Here is a function that you can use to convert a TColor value to a string representation of the corresponding HTML color code in Delphi: function TColorToHTMLColor(Color: TColor): string; begin Result := ‘#’ + IntToHex(Color and $00FFFFFF, 6); end; This function works by first masking off the high byte of the TColor value, which contains…

  • How can I use System.Beacon in Delphi

    In Delphi, System.Beacon is a unit that provides support for beacon communication in your Delphi programs. You can use System.Beacon to perform tasks such as scanning for nearby beacon devices, connecting to beacon devices, and sending and receiving data over beacon. To use System.Beacon in your Delphi program, you will need to include the unit…

  • Poem for new year!

    As the new year begins to dawn, We bid goodbye to the old. A time for fresh starts, new beginnings, And stories yet untold. In Delphi, our trusted language, We find a sense of home. With its Object Pascal syntax, We code and build and roam. We’ll face new challenges head on, In this new…

  • How can I find coordinate of a location in Delphi

    To find the coordinates (latitude and longitude) of a location in Delphi, you can use a geocoding service that converts a physical address or place name into geographic coordinates. One way to do this is to use the Google Maps Geocoding API, which allows you to programmatically retrieve the latitude and longitude for a given…

  • How can I calculate distance between to coordinates in Delphi

    To calculate the distance between two coordinates (points) in Delphi, you can use the Haversine formula, which is a method used to calculate the great-circle distance between two points on a sphere based on their longitudes and latitudes. Here is a function that you can use to calculate the distance between two coordinates in Delphi:…