{"id":20084511,"url":"https://github.com/voss2o0o/netformat","last_synced_at":"2026-02-24T18:39:21.205Z","repository":{"id":218763772,"uuid":"747308340","full_name":"VoSs2o0o/NetFormat","owner":"VoSs2o0o","description":"Core of this collection is the NetFormat-Unit. Use it to easily format a string in Delphi","archived":false,"fork":false,"pushed_at":"2024-01-30T21:57:49.000Z","size":203,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-28T18:37:11.147Z","etag":null,"topics":["delphi","delphi-source"],"latest_commit_sha":null,"homepage":"https://www.cloud-9.de/entwicklung/delphi-besserer-format-befehl","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VoSs2o0o.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-23T17:15:33.000Z","updated_at":"2024-06-16T17:59:01.000Z","dependencies_parsed_at":"2024-01-30T01:42:15.232Z","dependency_job_id":"87ae8750-1f73-44af-8bfe-702e335f52ea","html_url":"https://github.com/VoSs2o0o/NetFormat","commit_stats":null,"previous_names":["voss2o0o/netformat"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/VoSs2o0o/NetFormat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoSs2o0o%2FNetFormat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoSs2o0o%2FNetFormat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoSs2o0o%2FNetFormat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoSs2o0o%2FNetFormat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VoSs2o0o","download_url":"https://codeload.github.com/VoSs2o0o/NetFormat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VoSs2o0o%2FNetFormat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29795336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T16:37:37.581Z","status":"ssl_error","status_checked_at":"2026-02-24T16:37:37.074Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delphi","delphi-source"],"created_at":"2024-11-13T15:52:16.222Z","updated_at":"2026-02-24T18:39:21.183Z","avatar_url":"https://github.com/VoSs2o0o.png","language":"Pascal","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# NetFormat and Formatting Tools\n\nCore of this collection is the NetFormat-Unit. Use it to easily format a string in Delphi.\n\n```delphi\ntest:= FStr('Hallo {0} {1:D2} {2:dd-MM-yyyy HH:mm:ss}').Params('Test', 2.2, testdate.Now)\n```\nResult:\n```\nHallo Test 02 23.01.2024 12:00:01\n```\n\nAs you can see, all Delphitypes are accepted as input, and they will be convertet to String, and replaces\nthe appropiate position in the String.\n\nNetFormat.pas uses Generics, and Advanced RTTI, RegEx and shoul be running with Delphi XE or later.\nIt is testet in Delphi 10.3\n\n## Simple Syntax\n\n```delphi\ntest:= FStr('Hallo').ToString()\ntest:= FStr('Hallo {0}').Params('Test')\ntest:= FStr('Hallo {0}').Params(2)\n```\n\nResult:\n```\nHallo\nHallo Test\nHallo 2\n```\n\nUse {0} till {9} to specifiy the Position of Parameter.\n\n## Complex Syntax\n\n```delphi\ntest:= FStr('Hallo {0:F2}').Params(2)\n```\n\nResult:\n```\nHallo 2.00\n```\n\nUse a ':', one of the Spezifier and 'C', 'D' or 'F' followed by a number.\nMore about the Spezifiers below.\n\n```delphi\ntest:= FStr('Hallo {0:dd.MM.}').Params(testdate.Now)\n```\n\nResult:\n```\nHallo 23.01.\n```\n\nUse the Date/Time Syntax to Format a Date and/or Time. More about the Spezifiers below.\n\n## Format Specifiers\n\n### Following Specifiers are available:\n\n| Specifier  | Valid For | Length                   | Description                     | example              |\n| ---------- | --------- | ------------------------ | ------------------------------- | -------------------- |\n| C          | Int/Float | specifies decimals       | displays a Currency-Value       | 15    -\u003e C2: 15.00 € |\n| D          | Int/Float | leading zeros till length| number without decimals         | 9.1   -\u003e D3: 009     |\n| F          | Int/Float | specifies decimals       | float value                     | 2.457 -\u003e F2: 2.45    |\n| X          | Int/Float | specifies decimals       | HexString                       | 27    -\u003e X2: 1B      |\n| various    | TDateTime | \u003cnone\u003e                   | Formates a TDateTime, see below | see below            |\n\n### TDateTime Specifiers available:\n\n| Specifier  | Description              | example    |\n| ---------- | ------------------------ | ---------- |\n| y          | Year, one/two digits     | 24 or 9    |\n| yy         | Year, two digits         | 24 or 09   |\n| yyyy       | Year, 4 digits           | 2024       |\n| M          | Month, one/two digits    | 1 or 12    |\n| MM         | Month, two digits        | 01 or 12   |\n| MMM        | Month, abre.             | Jan or Dec |\n| MMMM       | Month name               | January    |\n| d          | Day, one/two digits      | 23 or 9    |\n| dd         | Day, two digits          | 23 or 09   |\n| ddd        | Weekday abre             | Tue        |\n| dddd       | Weekday                  | Tuesday    |\n| h / H      | Hour (12/24)  one/two dig| 12 or 9    |\n| hh / HH    | Hour (12/24)  two digits | 12 or 09   |\n| m          | Minute, one/two digits   | 49 or 9    |\n| mm         | Minute, two digits       | 49 or 09   |\n| s          | Second, one/two digits   | 49 or 9    |\n| ss         | Second, two digits       | 49 or 09   |\n| :,/,-      | allowed devider to format| 13:21      |\n\nin difference to Delphis FormatDateTime 'M' means Month, and 'm' means Minute, 'h' is 12 based Hour, 'H' is 24 based Hour.\nIts like Microsoft Format Specifier.\n\n## Alternative Call NetFormat\n\n```delphi\ntest:= TNetFormat.Str('Hallo {0} {1:D2} {2:dd-MM-yyyy HH:mm:ss}', 'Test', 2.2, testdate.Now)\n```\n\n## Debug\n\nfor fast and easy debugging an TDebug.Print Funktion is added. It work like the TNetFormat.Str method.\n\n```delphi\ntest:= Debug.Print('Hallo {0} {1:D2} {2:dd-MM-yyyy HH:mm:ss}', 'Test', 2.2, testdate.Now)\n```\n\n## DateTimeHelper\n\nThis lib is not related to the rest of the code, but it is very helpfull to handle TDateTime.\nColin Johnsun, https://github.com/colinj, MIT License.\nIf you own Delphi 11, a TDateTimeHelper is integrated in System.DateUtils with Update 2\n\n## Formatsettings\n\nYou can specifiy your own Formatsettings with 'fmt' (TFormatSettings or LCID):\n\n```delphi\ntest:= FStr('Hallo {0:F2}').fmt('de-DE').Params(2)\n```\nIn the example above, FStr uses German Settings, '1,00 €' istead of '$1.00' for example.\nDefault is your machine standard.\n\n## History\n### 23.01.2024: Version 1.0\n- first version :-)\n\n### 25.01.2024: Version 2.0\n- Old:\n```delphi\nNetFormat.ToString('Hallo {0} {1:D4} {2} {3}',\n                   'Welt', 55, 7.7, testdate);\n```\n- New: Format changed, I have found a more ellegant and slightly shorter Method:\n```delphi\nTStr('Hallo {0} {1:D4} {2} {3}').\n    Params('Welt', 55, 7.7, testdate);\n```\n- Structure changed from class to record\n- some minors addes to README\n\n### 28.01.2024: Version 3.0\n- Old:\n```delphi\nTStr('Hallo {0} {1:D4} {2} {3}').\n    Params('Welt', 55, 7.7, testdate);\n```\n- New: TStr -\u003e FStr, and old Format readded, beause some People wants a more\n  Delphi-Format like command:\n```delphi\nFStr('Hallo {0} {1:D4} {2} {3}').\n               Params('Welt', 55, 7.7, testdate);\nTNetFormat.TStr('Hallo {0} {1:D4} {2} {3}',\n               'Welt', 55, 7.7, testdate);\n```\n- Namespace VTools added to avoid conficts\n- Hex-Format added (\"X\")\n- TFormatStettings Support\n- Tests added\n- 'writeln' to Example added, to also have an console output\n- some minors changes to README\n\n### 30.01.2024: Version 3.0.1\n- Bugfix for compatiblility with \u003cD12 Versions\n- small fixes in readme\n- moved readme, license, groupproj to root\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoss2o0o%2Fnetformat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoss2o0o%2Fnetformat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoss2o0o%2Fnetformat/lists"}