How to replace text in a string, in a certain spot

Hello,

I am working on a drag and drop interactive. The text all comes from external XML files. When the user drops an answer onto a question I need the text from the dragger to display in the proper location in the question, if it is a fill in the blanks type question.

How can I do this?