.replace Macro

The .replace macro replaces all occurrences of a string with another string in a text block.

This macro is particularly useful when you work with naming conventions.

For more information about naming conventions, see Core Features Guide > The PowerDesigner Interface > Objects > Object Properties > Naming Conventions.

The .replace macro replaces the old string <OldString> with the <NewString> string in the text block <Block>.

.replace (old-string,new-string)
	block-input
.endreplace

The following parameters are available:

Parameter

Description

old-string

String to be replaced.

Type: Text

new-string

String which replaces old-string.

Type: Text

block-input

Parameter used to input text.

Type: Complex template

Output

The output is that all instances of the string <old-string> are replaced by instances of the string <new-string> in the replace block input.

In the following example, 'GetCustomerName' is converted to 'SetCustomerName'.

.replace( get , set )
GetCustomerName
.endreplace

In the following example, the variable %Name% is 'Customer Factory' and it is converted to 'Customer_Factory'.

.replace(" ", "_")
%Name%
.endreplace