Forum OpenACS Q&A: Re: How do I parse a string of the form "some @var_1@ text @var_2@ here" where the var_i's are stored in a tcl array or elsewhere?

The most simple approach is most probably this:

  set dict(@var_1@) substituted
  set dict(@var_2@) appears
  set string "some @var_1@ text @var_2@ here"
  puts [string map [array get dict] $string]

which prints out "some substituted text appears here"

Gustaf:

Thanks! I used this approach almost exactly; works fine!