Skip to content

Repository files navigation

StringKit-FP — a toolkit for working with text

StringKit-FP

Free Pascal Lazarus License CI Version

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:

program FirstStringKitCall;

{$mode objfpc}{$H+}

uses
  StringKit;

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

Compile from the repository root with:

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:

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

Add StringKitHelper if you prefer the equivalent helper spelling:

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:

python tools/test_docs_examples.py
python tools/build_all_docs.py --site-root build/docs-site
python tools/check_built_docs.py --site build/docs-site

The existing library suite is compiled and run by GitHub Actions on Ubuntu and Windows. See CONTRIBUTING.md for contribution guidance and CHANGELOG.md for release history.

Documentation site

The generated documentation homepage is configured in docs/layout.json. Its optional homepage.banner block names an SVG kept in the repository and supplies the image's alternative text. The generator copies that SVG to the built site's assets/homepage-banner.svg and renders it on the homepage; do not edit generated index.html files or add the banner to Markdown pages manually.

License

MIT

About

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.

Topics

Resources

Code of conduct

Contributing

Stars

13 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages