DTW_LASTPOS

AIX HP-UX Linux OS/2 OS/390 OS/400 PTX SUN Win NT
X X X X X X X X X

Purpose

Returns the position of the last occurrence of a string in another string, starting from the nth character and working backwards (right to left).

Format

@DTW_LASTPOS(stringIn1, stringIn2, n, position)

@DTW_LASTPOS(stringIn1, stringIn2, position)

@DTW_rLASTPOS(stringIn1, stringIn2, n)

@DTW_rLASTPOS(stringIn1, stringIn2)

Parameters

Table 86. DTW_LASTPOS Parameters
Data Type Parameter Use Description
string stringIn1 IN A variable or literal string searched for in stringIn2.
string stringIn2 IN A variable or literal string.
integer n IN The character position in stringIn2 to begin searching for stringIn1. The default is to start searching at the last character and scan backwards (from right to left).
integer position OUT The position of the last occurrence of stringIn1 in stringIn2. If no occurrence is found, 0 is returned.

Return Codes

Table 87. DTW_LASTPOS Return Codes
Return Code Explanation
-1001 The server could not process a Net.Data request to allocate memory.
1001 An input parameter contained a NULL value.
1003 An incorrect number of parameters were passed on a function call.
1005 A parameter passed on a function call, required to be a string variable, was of a different variable type.
1006 A literal string was passed on a function call for a parameter which was required to be an output parameter.
1007 A parameter contains a value which is not valid.

Examples

Example 1:

@DTW_LASTPOS(" ", "abc def ghi", result)

Example 2:

@DTW_LASTPOS(" ", "abc def ghi", "10", result)

Example 3:

@DTW_rLASTPOS(" ", "abc def ghi", "7")


[ Top of Page | Previous Page | Next Page | Index ]