ReplaceA

Description

Temporarily converts a string to DBCS based on the current locale, then replaces a portion of one string with another.

Syntax

ReplaceA (string1, start, n, string2)

Argument

Description

string1

The string containing characters you want to replace.

start

A long whose value is the position in bytes of the first character you want to replace in string1.

n

A long whose value is the number of bytes you want to replace in string1.

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.

Returns

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, ReplaceA returns null.

Usage

ReplaceA replaces the functionality that Replace had in DBCS environments in PowerBuilder 9. ReplaceA replaces a string by number of bytes, whereas Replace replaces a string by number of characters in both SBCS and DBCS environments. ReplaceA also specifies the starting position of the string to be replaced by number of bytes, whereas Replace specifies the starting position by number of characters.

In SBCS environments, Replace, ReplaceW, and ReplaceA return the same results.