UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

REPLACE Syntax REPLACE(dyn.array.expr, attrib.expr, val.expr, subval.expr, replace.expr) dyn.array.expr = replace.expr Description The UniBasic REPLACE function replaces data in a dynamic array with an expression. If an attribute, value, or subvalue is less than 0, the replacement string is placed after the last attribute, value, or subvalue as appropriate. If the position given does not exist (for example, attribute 6 specified in an array with two attributes), the necessary number of attribute, value, and subvalue marks are added to create the specified position. Null Value Handling With null value handling on, when UniBasic encounters the null value in a command parameter when a number is expected (attrib.expr, val.expr, subval.expr,), it displays a warning message and uses 0. 1-682 UniBasic Commands Reference

Parameters The following table describes each parameter of the syntax. Parameter Description dyn.array.expr Specifies the dynamic array to modify. attrib.expr Specifies the attribute to replace. The following rules also apply: If attrib.expr is a negative number, replace.expr is appended to the existing value instead of replacing it. If attrib.expr is 0, the preceding level (attribute, value, subvalue) is replaced by replace.expr. val.expr Specifies the value of the attribute to replace. The following rules also apply: If attrib.expr is a negative number, replace.expr is appended to the existing value instead of replacing it. If attrib.expr is 0, the preceding level (attribute, value, subvalue) is replaced by replace.expr. subval.expr Specifies the subvalue of the value of the attribute to replace. The following rules also apply: If attrib.expr is a negative number, replace.expr is appended to the existing value instead of replacing it. If attrib.expr is 0, the preceding level (attribute, value, subvalue) is replaced by replace.expr. replace.expr Specifies the replacement value. REPLACE Parameters Examples In this example, the program statement replaces the first value of attribute 2 with the value ‘220 W. 44TH’: CLIENT.REC = REPLACE(CLIENT.REC,4,1,0,'220 W. 44TH') REPLACE 1-683

Parameters<br />

The following table describes each parameter of the syntax.<br />

Parameter Description<br />

dyn.array.expr Specifies the dynamic array to modify.<br />

attrib.expr Specifies the attribute to replace. The following rules also apply:<br />

If attrib.expr is a negative number, replace.expr is appended to the<br />

existing value instead of replacing it.<br />

If attrib.expr is 0, the preceding level (attribute, value, subvalue) is<br />

replaced by replace.expr.<br />

val.expr Specifies the value of the attribute to replace. The following rules also<br />

apply:<br />

If attrib.expr is a negative number, replace.expr is appended to the<br />

existing value instead of replacing it.<br />

If attrib.expr is 0, the preceding level (attribute, value, subvalue) is<br />

replaced by replace.expr.<br />

subval.expr Specifies the subvalue of the value of the attribute to replace. The<br />

following rules also apply:<br />

If attrib.expr is a negative number, replace.expr is appended to the<br />

existing value instead of replacing it.<br />

If attrib.expr is 0, the preceding level (attribute, value, subvalue) is<br />

replaced by replace.expr.<br />

replace.expr Specifies the replacement value.<br />

REPLACE Parameters<br />

Examples<br />

In this example, the program statement replaces the first value of attribute 2 with the<br />

value ‘220 W. 44TH’:<br />

CLIENT.REC = REPLACE(CLIENT.REC,4,1,0,'220 W. 44TH')<br />

REPLACE 1-683

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!