xs.property()

Read(1430) Label: node strings, property values,

Description:

Read property values from node strings.

Syntax:

xs.property(n,v)

Note:

The function retrieves value of property named n from node string xs. Set n’s value as v if parameter v is present, and delete n if v is absent. Return a table sequence made up of all properties when no parameters exist.

Parameter:

xs

Node strings, whose format is “name1=value1 name2=value2...” .

n

Node string name.

v

Null or a string.

Option:

@c

Separate node strings by commas or semicolons; use spaces by default.

@j

Use colons to separate node string name and its value; use the equal sign by default

@q

Enclose values by double quotation marks.

@v

Read the string and then parse it into value; return a sequence by default.

Return value:

A single value/Sequence

Example:

 

A

 

1

color=red size=20 price=500

 

2

=A1.property("color","blue")

Change the value of node string named “color” into “blue” .

3

=A1.property@q("size")

Enclose the value with double quotation marks.

4

=A1.property@v()

 

Use @v option to read the string first and then parse it into a value; as parameters are absent, the function returns a sequence of all properties.

5

color:red;size:20;price:500

 

6

=A5.property@cj("color",)

Use @cj options to retrieve property vlaues. Use semicolon to separate node strings, and use colon to separate node string name and node string value. Since parameter n is “color” and the value of parameter v  is null, delete the node from the node strings. Below is the result returned: