Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

LastPos – PB Docs 2019 – PowerBuilder Library

LastPos – PB Docs 2019

LastPos

PowerScript function

Description

Finds the last position of a target string in a source
string.

Syntax

Argument

Description

string1

The string in which you want to find string2.

string2

The string you want to find in string1.

searchlength (optional)

A long that limits the search to the leftmost searchlength
characters of the source string string1. The default is the
entire string.

Return value

Long.

Returns a long whose value is the starting position of the last
occurrence of string2 in string1 within the characters specified in
searchlength. If string2 is not found in string1 or if searchlength is 0,
LastPos returns 0. If any argument’s value is null, LastPos returns
null.

Usage

The LastPos function is case sensitive. The entire target string
must be found in the source string.

Examples

This statement returns 6, because the position of the last
occurrence of RU is position 6:

This statement returns 3:

This statement returns 0, because the case does not match:

This statement searches the leftmost 4 characters and returns 0,
because the only occurrence of RU is after position 4. The search length
must be at least 7 (to include the complete string RU) before the
statement returns 6 for the starting position of the last occurrence of
RU:

These statements change the text in the SingleLineEdit sle_group.
The last instance of the text NY is changed to North East:

These statements separate the return value of GetBandAtPointer into
the band name and row number. The LastPos function finds the position of
the (last) tab in the string and the Left and Mid functions extract the
information to the left and right of the tab:

These statements tokenize a source string backwards:

See also

Pos


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x