A.modify ()

Read(718) Label: specified position, assign, sequence,

Description:

Assign value(s) to one or more members of a sequence according to the specified position(s).

Syntax:

A.modify(k,x)

Assign x to the kth member of sequence A

A.modify(k,X)

Assign members of X to members of A in order from the kth position to the (k+|X|-1)th position; do the assignment backward from the end when k<0

Note:

The function assigns x to the kth member of sequence A or members of X to the members of A from the kth position to the number (k+|X|-1)th position in order.

Parameter:

A

A sequence

k

A member position; If k is greater than the length of sequence A, then append the member in the end

x

A member value

X

A sequence

Option:

@n

Return the modified record or a record sequence of modified records

Return value:

A sequence

Example:

 

A

 

1

=["a","c","d","e","f"]

 

2

=A1.modify(2,"g")

[a,g,d,e,f].

3

=A1.modify(6,[2,4,5])

[a,g,d,e,f,2,4,5]; append the values at the end as the specified position exceeds the limit.

4

=demo.query("select * from STUDENTS")

 

5

=A4.modify@n(2:3,ID+10:ID)

Return a record sequence of modified records.

6

=A1. modify(-2,"h")

Assign values backward and return [a,g,d,e,f,2,4,h,5] as parameter k<0.

Related function:

A.delete()

A.insert()

T.modify()