ResemblesText
Function ResemblesText( const AText, AOther : string) : Boolean
Example
procedure ScriptEvent(var Value: variant);
begin
Value := ResemblesText('Robert', 'Rupert');
end;
Usage
ResemblesText reports whether two strings resemble each other through Velox's configurable phonetic comparison.
Parameters
| Name | Type | Description |
|---|---|---|
AText | string, const | First text value. |
AOther | string, const | Second text value. |
Returns
It returns False when that procedure variable is nil.
Behaviour
Under the default procedure, each input is converted independently to a Soundex code and the codes are compared exactly. Soundex is a coarse phonetic grouping aid, not a spelling, identity or language-aware similarity score.
Errors
The standard procedure has no expected content-dependent exception for ordinary strings. Any exception raised by a replacement procedure propagates through this call.
Usage notes
Use explicit SoundexSimilar when the algorithm and length must be visible in the script. Use exact keys and additional evidence for deduplication or identity decisions.
Additional Technical Info
ResemblesText calls Delphi's process-wide phonetic comparison procedure. In the normal Velox runtime that procedure is SoundexProc, which compares four-character Soundex codes.
The example normally returns True because both names have the default code R163. It is source-reviewed and is not executed by the documentation workflow.
Implementation
Velox registers System.StrUtils.ResemblesText directly. The routine itself sets False, checks Assigned(ResemblesProc), and invokes that procedure variable when present. Delphi initialises the variable to SoundexProc; the default procedure calls SoundexSimilar with the default length of four.
This indirection is material: the public name does not permanently guarantee Soundex. Native code in the Velox process can replace or clear the global procedure, although the variable is not exposed as a normal Velox script assignment.
Edge cases and quirks
- Two empty strings normally return
Truebecause both default Soundex results are empty. One empty and one non-empty string returnFalse. - The default Soundex algorithm primarily scores ASCII letters. Non-Latin text and punctuation can collapse to weak or misleading codes.
- Different names can share a code. A
Trueresult must not be treated as proof that people, organisations or addresses are the same. - If native host code sets
ResemblesProcto nil, every call returnsFalse. A replacement procedure can change results, performance and errors process-wide. - This function uses
ResemblesProc, not the separateAnsiResemblesProcvariable. - Free Pascal documents its corresponding default behaviour, but cannot establish whether a particular Velox process has changed Delphi's global procedure.
Side effects
The standard Soundex procedure has no external side effect. The dispatcher reads shared process-wide procedure state; a host-supplied replacement can have its own effects.
Performance and concurrency
The default work is linear in both input lengths and allocates two short codes. Reads of a stable procedure pointer are inexpensive, but changing the global pointer concurrently is host-wide mutable state and is outside the script's control.
Related entries
SoundexSimilarexplicitly compares Soundex codes at a requested length.Soundexreturns the code for inspection or storage.SameTextperforms case-insensitive text equality instead of phonetic grouping.
External references
- Embarcadero
System.StrUtils.ResemblesText - Free Pascal
ResemblesText- compatibility context; Delphi's currentResemblesProcvalue defines Velox's actual algorithm.