0

我想在字典中拆分文本变量的内容。内容是格式为 key = value 的行序列。

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

感谢您的帮助。萨尔瓦多

4

1 回答 1

1

你可以试试:

♥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⟧
于 2019-10-02T11:40:17.077 回答