EgStrParser Overview

EgStrParser is a Delphi library that parses free text typed by the user 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 require the developer to handle the user input of every field: 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 of 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 show the four outputs for two common cases. The library handles many other combinations of data types, operators and dialects; they are described in the rest of this manual.

Example 1 A single value to look for the clients whose name ends in O’Brien, using operator sopLikeLeft and option opTrim (without opTrim, the spaces typed around the name would be part of the value).

User input: O'Brien

TParseResult field 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 in a rush or pasted from different documents that use different separators and date formats; locale en-US, SQL dialect sqlElevateDB.

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

TParseResult field Value
ParsedValue (string) ; 11/2/2026 ; 12/3/2026 ; 1/8/2026 ; 12/1/2026
Values (array) [’‘, ’11/2/2026’, ‘12/3/2026’, ‘1/8/2026’, ‘12/1/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')

The format of date, time and boolean literals depends on the SQL dialect; sqlElevateDB is the default.

The same call handles single values, lists separated by commas or semicolons, and ranges, for every data type and SQL dialect. The range separator (~ by default) is configurable.

Supported data types

Integer, decimal (fixed-point), floating-point, boolean, date, time, date-time and string. See Input types.

Supported SQL dialects

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

How to use it

Both share the same parsing engine and produce identical results. See Using EgStrParser.

Contents

Contact and support

Sales and licensing: https://www.sales.easygate.pt.

(C) 2026 Easygate, Lda