Hi,
In Macro6, I have a lot of key-value pairs, each value needs to be replaced(replace [] with ┃)
So, I want to define the duplicate part of the code as a function kvs , I can simply use it in Macro7
But I ran into a problem: In practical use, where the parameters of key-value pairs are not fixed, e.g: A Av B Bv C Cv D Dv E Ev ....
How do I define the parameters for the function kvs ? Or is there a better way to achieve it?
Thanks in advance for any advice and help
david
Macro Macro6
Macro Macro7
Function kvs
In Macro6, I have a lot of key-value pairs, each value needs to be replaced(replace [] with ┃)
So, I want to define the duplicate part of the code as a function kvs , I can simply use it in Macro7
But I ran into a problem: In practical use, where the parameters of key-value pairs are not fixed, e.g: A Av B Bv C Cv D Dv E Ev ....
How do I define the parameters for the function kvs ? Or is there a better way to achieve it?
Thanks in advance for any advice and help
david
Macro Macro6
out
str A="1 key"
str Av=
;1 hello
;1 world
Av.replacerx("[]" "┃")
str B="2 key"
str Bv=
;2 hello
;2 world
Bv.replacerx("[]" "┃")
str C="3 key"
str Cv=
;3 hello
;3 world
Cv.replacerx("[]" "┃")
str kv=
F
;{A}={Av}
;{B}={Bv}
;{C}={Cv}
IStringMap m._create
m.AddList(kv "=")
str v=m.Get("1 key")
if(v)
,v.replacerx("┃" "[]")
,out v
else
,out "not found"
Macro Macro7
out
str A="1 key"
str Av=
;1 hello
;1 world
str B="2 key"
str Bv=
;2 hello
;2 world
str C="3 key"
str Cv=
;3 hello
;3 world
str kv=kvs(A Av B Bv C Cv)
IStringMap m._create
m.AddList(kv "=")
str v=m.Get("1 key")
if(v)
,v.replacerx("┃" "[]")
,out v
else
,out "not found"
Function kvs