Parse Key-Value from texts
Example
Write SPL script:
A |
|
1 |
A=123 B=456 C=789 D=INV E=67 |
2 |
=A1.property() |
3 |
=A1.property@v("A") |
4 |
color:red;size:20;price:500 |
5 |
=A4.property@vcj() |
6 |
{S1}ADD1;{S2}ADD2;{S3}ADD17;{S8}AD234 |
7 |
=replace(A6,"{","") |
8 |
=replace(A7,"}","=") |
9 |
=A8.property@vc() |
A1 KV text, K and V are separated by an equal sign, and each pair of KV is separated by a space
A2 The function property reads the attribute value from the KV text. When the parameter is omitted, all attributes are returned to form a table sequence. The result is:
name |
value |
A |
123 |
E |
67 |
D |
INV |
C |
789 |
B |
456 |
A3 The function property reads the property value of A from the KV text. @v means that it will be parsed into a value after reading it out. The result is:123
A4 KV text, K and V are separated by a colon, and each pair of KV is separated by a semicolon
A5 The function property reads the attribute value from the KV text. When the parameter is omitted, all attributes are returned to form a sequence table. @v means that the text is read and then parsed into a value. @c means that the section text is separated by a comma or semicolon, and the result is :
name |
value |
color |
red |
size |
20 |
price |
500 |
A6 KV text, the format is {K}V, and each pair of KV is separated by a semicolon
A7, A8 Change the format of KV text to K=V
A9 The function property reads the attribute value from the KV text. When the parameter is omitted, all attributes are returned to form a table sequence. @v means read it and then parse it into a value, @j means separate texts as name and value with a colon, and @c means Separate texts with commas or semicolons, and the result is:
name |
value |
S3 |
ADD17 |
S2 |
ADD2 |
S1 |
ADD1 |
S8 |
AD234 |
SPL Official Website 👉 https://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc_Desktop/
SPL Learning Material 👉 https://c.scudata.com
Discord 👉 https://discord.gg/cFTcUNs7
Youtube 👉 https://www.youtube.com/@esProcDesktop
Linkedin Group 👉 https://www.linkedin.com/groups/14419406/
Chinese version