0

I'd like to split the content of a text variable in a dictionary. The content is a sequence of rows with format key = value.

Owner = name1@domain.com \r\n Validator = name2@domain.com \r\n Approver = name3@domain.com \r\n

Thank you for your help. Salvatore

Salvatore
  • 15
  • 4

1 Answers1

1

You can Try:

♥text = ⊂"Owner =  name1@robotics.com\r\nOwner2 = name2@robotics.com"⊃
text.find text ♥text regex ‴(?<keys>.*)=(?<values>.*)‴
for ♥i from 1 to ♥keys⟦count⟧
      if ⊂♥i == 1⊃
          ♥dict = ⟦dictionary⟧♥keys⟦♥i⟧❚♥values⟦♥i⟧
      else
          ♥dict⟦♥keys⟦♥i⟧⟧ = ♥values⟦♥i⟧
      end if
end for
dialog ♥dict⟦owner⟧