strlcs(X;Y)
Returns the longest contiguous substring that appears in two given strings.
Syntax
strlcs(X;Y)
bstrlcs(X;Y)
Input
| Argument | Type | Description |
|---|---|---|
X |
text | The first of the two strings in which to search for the longest contiguous
substring A scalar value or the name of a column |
Y |
text | The second of the two strings in which to search for the longest contiguous
substring A scalar value or the name of a column |
Return Value
Returns the text value corresponding to the longest contiguous substring that appears in
both X and Y. Returns the empty string (N/A) if there is
no common substring. If there is more than one substring with the same maximal length, the
first is returned.
If X or Y is N/A, the result is N/A.
Sample Usage
string1 |
string2 |
strlcs(string1;string2) |
|---|---|---|
| 'appliance' | 'compliant' | 'plian' |
| 'affluent' | 'afferent' | 'aff' |
| 'mouse' | 'lion' | 'o' |
| 'mouse' | 'cat' | '' |
| '' | 'cat' | '' |
| 'mouse' | '' | '' |
Additional Information
strlcsis Unicode (UTF-8) compliant and will work with Unicode or plain ASCII text fields.- If passed a string argument that is not legal Unicode, it will by default signal an error (configurable as a user preference).
- A corresponding function
bstrlcscan be used with non-Unicode strings (e.g., binary or legacy encodings).
