strreverse(X;Y)
Returns the characters, or the elements delimited by a particular value, of a given string in reverse.
Syntax
strreverse(X;Y)
bstrreverse(X;Y)
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 character or string to be used as the delimiter in X A scalar value or the name of a column |
Return Value
If Y
is empty, the function returns the text value corresponding to the
reversed characters of the string X
. Otherwise, it splits string
X
using Y
as a delimiter and returns a text value
corresponding to a reversed, delimited list of the elements.
If X
is N/A, the result is N/A. If Y
is N/A, the result
is a character-by-character (rather than element-by-element) reversal of
X
.
Sample Usage
value |
delimiter |
strreverse(value;delimiter) |
---|---|---|
'apple,banana,cherimoya' | ',' | 'cherimoya,banana,apple' |
'foo<>bar<>baz' | '<>' | 'baz<>bar<>foo' |
'foo<>bar<>baz' | '' | 'zab><rab><oof' |
Additional Information
strreverse
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
bstrreverse
can be used with non-Unicode strings (e.g., binary or legacy encodings).