strlcspos(X;Y)

Returns the position in the second string of the longest contiguous substring that appears in both given strings.

Syntax

strlcspos(X;Y)
bstrlcspos(X;Y)

Input

Argument Type Description
X text The first of the two strings in which to determine the position of the longest contiguous substring

A scalar value or the name of a column

Y text The second of the two strings in which determine the position of the longest contiguous substring

A scalar value or the name of a column

Return Value

Returns the integer value corresponding to the position in Y of the longest contiguous substring that appears in both X and Y. Returns 0 if there is no common substring. If there is more than one substring with the same maximal length, or if the same substring appears more than once in Y, the first position is returned.

If X or Y is N/A, the result is 1.

Sample Usage

string1 string2 strlcspos(string1;string2)
'appliance' 'compliant' 4
'affluent' 'afferent' 1
'mouse' 'lion' 3
'mouse' 'cat' 0
'' 'cat' 1
'mouse' '' 1

Additional Information

  • strlcspos is 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 bstrlcspos can be used with non-Unicode strings (e.g., binary or legacy encodings).