What is EgStrParser

EgStrParser is a Delphi component library that parses free-text user input into typed, validated values and generates four ready-to-use outputs: a string with the normalized input in human readable form, a list of normalized display values, a list of individually SQL-formatted literals, and a complete SQL comparison fragment ready to be inserted into a query.

The problem it solves

Search and filter fields in database applications typically require the developer to handle user input for every field individually: validate the value, convert it to the correct type, and build the SQL expression. The logic must be repeated for every field and every form, and must cope with locale-specific formats, optional ranges, multi-value lists, and empty input.

EgStrParser centralizes that logic in a single call. The developer passes the raw text from the input control and the expected data type; the library returns a ready-to-use SQL expression and the parsed values, or a precise error code if the input is invalid.

What it does

The following examples illustrate the four outputs for two common cases. The library handles many other combinations of data types, operators, and dialects; these are covered in detail in Part 2.

Example 1 A single value to look for the names of all clients named O’Brien, using operator sopLikeLeft.

User Input : O'Brien

Output:

TParseResult. Value
ParsedValue (String) O’Brien
Values[] (Array) [O’Brien]
SQLValues[] (Array) [‘O’‘Brien’]
SQLExpression (String) LIKE ‘%O’‘Brien’ ESCAPE ‘\’

Example 2 A list of dates, typed by someone in a rush, doing copy/paste from different documents, that use different separators and date formats, locale en-US, target SQL dialect sqlElevateDB.

User Input : ,11022026, 12/3, 1-8, 2026.12.01

Output:

TParseResult. Value
ParsedValue (String) ; 11/02/2026 ; 12/03/2026 ; 01/08/2026 ; 12/01/2026
Values[] (Array) [’‘, ’11/02/2026’, ‘12/03/2026’, ‘01/08/2026’, ‘12/01/2026’]
SQLValues[] (Array) [‘NULL’, ‘DATE’‘2026-11-02’’‘, ’DATE’‘2026-12-03’’‘, ’DATE’‘2026-01-08’’‘, ’DATE’‘2026-12-01’’’]
SQLExpression (String) IN (NULL, DATE ‘2026-11-02’, DATE ‘2026-12-03’, DATE ‘2026-01-08’, DATE ‘2026-12-01’)

ParsedValue contains normalized, locale-aware values as the parser interpreted them, in human readable form. Values[] contains a list of individual normalized, locale-aware values ready for display or logging. SQLValues[] contains a list of individual SQL literals ready for use in parameterized queries or custom expressions. SQLExpression is the complete comparison fragment, ready to be appended to a WHERE clause.

The exact format of date, time, and boolean literals depends on the SQL dialect; sqlElevateDB is the default. Dialect differences are covered in detail in Part 2.

The same call handles single values, comma or semicolon separated lists, and ranges, across all supported data types and SQL dialects. The range separator (~ by default) is configurable.

Supported data types

Integer, Decimal (fixed-point), Floating-point, Boolean, Date, Time, DateTime and String.

Supported SQL dialects

ElevateDB, MySQL/MariaDB, PostgreSQL, Microsoft SQL Server, SQLite, Firebird, Oracle, Microsoft Access, DBISAM and BDE/Paradox.

How to use it

EgStrParser can be used in two ways:

Both approaches share the same parsing engine and produce identical results.

(C) 2026 Easygate, Lda