LAST( ) function

Returns a string containing a specified number of characters from the right side of a string.

Syntax

LAST(string, length)

Parameters

string

Character. The value to return the characters from.

length

Numeric constant. A number, or numeric expression, indicating how many characters to return.

Output

Character.

Remarks

This function returns a specified number of characters from the end of a string. You can use it to isolate data.

Note

If the results produced by the LAST( ) function are blank, this may be due to trailing spaces in string. For example, the output for LAST(“6483-30384 “, 3) is “ “. Use the ALLTRIM( ) function to remove any trailing spaces in string before you use LAST( ) in an expression.

Examples

Example Return value

LAST(“Account Type: Savings”, 7)

“Savings”

LAST("abcdefghi", 5)

“efghi”

LAST("abcdefghi ", 5)

“ghi  “

LAST("abc", 6)

“   abc”

LAST(“Credit”, 20)

“    Credit”

The string parameter is shorter than the specified length, so leading spaces are added to the output.



(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback