Static API vs helper API

StringKit-FP has two ways to call most operations. Pick the one that makes the surrounding code clearer; they are alternatives, not two implementations.

Static API#

Add StringKit and call a class function:

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

Static calls make the owning library obvious. They are also the only natural form for operations whose main input is not a source string, such as TStringKit.ToRoman(2026).

Helper API#

Add both StringKit and StringKitHelper:

Pascal
Clean := ' hello '.Trim;

The helper is useful for left-to-right reading and chaining:

Pascal
Clean := '  HELLO   WORLD  '.Trim.CollapseWhitespace.ToLower;

Feature flags#

With no helper symbols, StringKit-FP defines SK_ALL, so every helper group is available. To build only selected groups, define SK_ANY at the project/compiler level and add the groups you need, for example -dSK_ANY -dSK_ENCODE.

GroupHelper area
SK_MANIPtrim, padding, whitespace, substring
SK_MATCHregex, replacement, contains, words
SK_COMPAREdistance, similarity, fuzzy matching
SK_CASEtitle, camel, Pascal, snake, kebab case
SK_VALIDATEemail, URL, IP, date
SK_FORMATtruncation and number/file-size formatting
SK_NUMERICRoman numerals, ordinals, number words
SK_ENCODEHTML, URL, Base64, hex
SK_SPLITsplit and join
SK_PHONETICSoundex, Metaphone, readability, n-grams

Defines inside a program do not change a separately compiled StringKitHelper unit. Set them in Lazarus project options or the FPC command line. The helper feature-flags reference and coverage table have the complete details.