basic.replace

Function/BASIC Program, Releases: AP and R83

Replaces element in string expression.

Syntax

replace(dynamic.array.expression, ac.expression; string.expression) replace(dynamic.array.expression, ac.expression, vc.expression; string.expression) replace(dynamic.array.expression, ac.expression, vc.expression, sc.expression, string.expression)

Description

inserts or replaces a specific attribute, value, or subvalue in the string referenced by 'dynamic.array.expression' with the value referenced in 'string.expression'.

'-1' may be specified as the 'ac.expression', 'vc.expression', or 'sc.expression'. This appends 'string.expression' as the last element in the respective location. If the last character of string.expression is not the correct separator, the appropriate 'mark' character (attribute, value or subvalue) is inserted before the 'expression' is added.

Alternate method, using dynamic array reference symbols:

dynamic.array.expression<ac.expression {,vc.expression {,sc.expression}> = string.expression

Example

1) customer.item(1) = replace(customer.item(1),1,1,0,name)
-or-
customer.item(1) = replace(customer.item(1),1,1;name)

In this example, value 1 of attribute 1 in the first element of the dimensioned
array, 'customer.item', is replaced with the data value in the
variable 'name'. This example could alternately be coded as:

customer.item(1)<1,1> = name

2) string<1,-1> = value
-or-
string = replace(string,1,-1,0,value)
-or-
string = replace(string,1,-1;value)

These statements add a new value at the end of attribute 1 of
'string'.

See Also

Command Name Type Description
basic.statements Definition Definition of statements and functions.
basic.string.expression Definition An expression which evaluates to a string.
basic.array.references Definition Referencing arrays.
basic.read Statement Reads item into dimensioned or dynamic array.
basic.ac.expression Definition Derives an attribute count.
basic.vc.expression Definition Derives a value count.
basic.replace.statement Statement Maintains integrity of bridges.
basic.del Statement Alternate method of 'delete'.
basic.ins Statement Alternate method of 'insert'.
basic.functions Definition elements in FlashBASIC or Pick/BASIC language expressions, returning a single value in place, as a function of the arguments. A function can be used anywhere a variable or expression is used.
basic.sc.expression Definition Derives a subvalue count.
basic.insert Function Inserts element into array.
basic.locate Statement Locates element in string expression.
basic.array.variable Definition References a dimensioned array.
basic.extract Function Extracts element from array.
basic.delete.function Function Deletes element from array.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.