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

Replace – PB Docs 2019 – PowerBuilder Library

Replace – PB Docs 2019

Replace

PowerScript function

Description

Replaces a portion of one string with another.

Syntax

Argument

Description

string1

The string in which you want to replace characters with
string2.

start

A long whose value is the number of the first character
you want replaced. (The first character in the string is number
1.)

n

A long whose value is the number of characters you want to
replace.

string2

The string that will replace characters in string1. The
number of characters in string2 can be greater than, equal to,
or less than the number of characters you are replacing.

Return value

String. Returns the string with the characters replaced if it
succeeds and the empty string if it fails. If any argument’s value is
null, Replace returns null.

Usage

If the start position is beyond the end of the string, Replace
appends string2 to string1. If there are fewer characters after the start
position than specified in n, Replace replaces all the characters to the
right of character start.

If n is zero, then, in effect, Replace inserts string2 into
string1.

Examples

These statements change the value of Name from Davis to Dave:

This statement returns BABY RUTH:

This statement returns Closed for the Winter:

This statement returns ABZZZZEF:

This statement returns ABZZZZ:

This statement returns ABCDEFZZZZ:

These statements replace all occurrences of red within the string
mystring with green. The original string is taken from the SingleLineEdit
sle_1 and the result becomes the new text of sle_1:

See also

Replace method for DataWindows in the section called “Replace” in DataWindow Reference.


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