Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

stringkit-fp

Comprehensive string toolkit for Free Pascal and Lazarus with 80+ operations for case conversion, validation, fuzzy matching, parsing, encoding, phonetics and text analysis. No third-party dependencies.

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

StringKit-FP — a toolkit for working with text

StringKit-FP

Practical string handling for Free Pascal and Lazarus: cleaning, identifier case conversion, validation, encoding, regex extraction, approximate matching, and readability helpers. It has no third-party runtime dependencies.

Learn StringKit-FP

The repository documentation index links to all beginner guides, topic guides, contracts, and helper references.

Quick start

Add src/ to your project’s unit search path, then:

pascal
program FirstStringKitCall;

{$mode objfpc}{$H+}

uses
  StringKit;

begin
  Writeln(TStringKit.ToSnakeCase('HelloWorld'));
end.

Compile from the repository root with:

text
fpc -Fusrc first_stringkit_call.pas

It prints hello_world; the same program is checked as a documentation example.

For Lazarus, open packages/lazarus/stringkit_fp.lpk, compile it, then select Use → Add to Project. You can instead add src/ under Project Options → Compiler Options → Paths → Other Unit Files.

Static and helper calls

The static API is the simplest starting point:

pascal
Clean := TStringKit.Trim(' hello ');

Add StringKitHelper if you prefer the equivalent helper spelling:

pascal
Clean := ' hello '.Trim;

They use the same implementation. Read Static API vs helper API before opting into selective SK_* helper flags.

Important contracts

  • SubString uses Pascal 1-based indexing.
  • Current classification, case conversion, and encoding behaviour is largely byte/ASCII-oriented, not Unicode grapheme-aware.
  • Validators are practical syntax checks, not complete RFC validation or reachability checks.
  • PercentEncode uses %20 for spaces; FormURLEncode and legacy URLEncode use +.
  • Prefer TryHexDecode, TryDecode64, and TryFromRoman when malformed input is expected.

See Contracts and limitations and Encoding for the details.

Verification

On a system with FPC 3.2.2 and DocSprout installed:

text
python tools/test_docs_examples.py
python -m docsprout check
python -m docsprout audit --strict

The library suite, documentation examples, and documentation site are validated by GitHub Actions on Ubuntu and Windows. See CONTRIBUTING.md for contribution guidance and CHANGELOG.md for release history.

Documentation site

The documentation site is built with DocSprout. Markdown lives in README.md and docs/; docs/layout.json controls the published pages and navigation, and docs/docsprout.json holds the project identity, the teal colour preset, the banner, and the homepage cards.

Install DocSprout and preview the site locally:

text
python -m pip install "https://github.com/ikelaiah/docsprout/archive/refs/tags/v1.1.2.zip"
python -m docsprout serve

Build the static site and, when you need a portable copy, the deterministic offline archive with its SHA-256 sidecar:

text
python -m docsprout build --output build/docs-site --release <release> --offline-archive build/artifacts/stringkit-fp-docs-<release>.zip

Version history restarts with the DocSprout pipeline, so the published site documents the current release until a new docs/versions.json history is introduced. The Publish documentation workflow validates and builds the site on every published release and on manual dispatch, deploys it to GitHub Pages, and uploads the offline ZIP as a build artifact.

License

MIT