strfollow(X;Y;B)
Returns the first position where two strings differ from one another, or 0 if they are equal.
Syntax
strfollow(X;Y;B)
bstrfollow(X;Y;B)
Input
Argument | Type | Description |
---|---|---|
X |
text | The string on which to apply the function A scalar value or the name of a column |
Y |
text | The string to compare to X A scalar value or the name of a column |
B |
integer | Specifies whether the comparison is case sensitive or not If
If |
Return Value
Returns an integer value corresponding to the first position where the string
X
differs from the string Y
. If the strings are the
same, the function returns 0.Note: The comparison is case
insensitive if and only if
B
=0.Unicode code-point order (which does not correspond to the lexicographic order used in any particular language) is used for comparison. Generic (non-language-specific) Unicode case folding is used for case-insensitive comparisons.
If both X
and Y
are N/A, then the result is 0. If either
X
or Y
is N/A, then the result is 1.
Sample Usage
value |
string2 |
caseflag |
strfollow(value;string2;caseflag) |
---|---|---|---|
'apple' | 'application' | 1 | 5 |
'apple' | 'app' | 1 | 4 |
'apple' | 'Apple' | 0 | 0 |
'Apple' | 'apple' | 1 | 1 |
'Apple' | '' | 1 | 1 |
'' | '' | 1 | 0 |
Additional Information
strfollow
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
bstrfollow
can be used with non-Unicode strings (e.g., binary or legacy encodings).