USUBSTR
The USUBSTR function returns a substring of a character string argument that is encoded in UTF-8.
The function type is alphanumeric.
- argument-1
- Must be of class alphabetic or alphanumeric. argument-1 must contain valid UTF-8 encoded characters.
- argument-2
- Must be an integer that is greater than zero. It represents the starting position of a substring in argument-1.
- argument-3
- Must be an integer that is greater than or equal to zero. It represents the length of a substring in argument-1.
Note: The sum of argument-2 and argument-3 minus
one must be less than or equal to ULENGTH(argument-1).
Suppose argument-2 = n and argument-3 = m, the returned value is an alphanumeric character string that contains m UTF-8 characters in argument-1, starting with the nth character.
For example, if A is an alphanumeric item that contains the
UTF-8 value x'4BC3A4666572' ('Käfer'), the returned values
are as follows:
- USUBSTR(A 1 2) returns x'4BC3A4' ('Kä')
- USUBSTR(A 2 1) returns x'C3A4' ('ä')
- USUBSTR(A 2 2) returns x'C3A466' ('äf')
- USUBSTR(A 3 2) returns x'6665' ('fe')