Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Access the values of the hash table
#2
I thought of the following method, but the final replacement result is wrong, why?

Macro Macro5
Code:
Copy      Help
out
_s=
;mes1 :sub.Sub1
;mes2 :sub.Sub2
;
;#sub Sub1 m
;_s="hello 1"
;mes _s
;
;#sub Sub2 m
;_s="hello 2"
;mes _s
ARRAY(str) as
findrx(_s "(?m)^#sub Sub(\d+) m(?:(?!^#sub Sub\d+ m)[\s\S])+" 0 4 as)

str k v kv
for _i 0 as.len
,k=as[1 _i]
,v=as[0 _i].trim
,v.findreplace("[]" "┃")
,kv.formata("%s=%s[]" k v)
out kv

IStringMap m._create
m.AddList(kv "=")

v=m.Get("1")
if(v)
,out v ;;The output is correct
,out v.findreplace("┃" "[]") ;;The output is wrong, why?
else
,out "not found"


Messages In This Thread
Access the values of the hash table - by Davider - 12-03-2022, 01:42 PM
RE: Access the values of the hash table - by Davider - 12-06-2022, 01:20 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)