Reputation: 2046
I want to change these items in my context with dynamic fields. parameters: "Dear {prefix} {name} {family}, thank you for accepting....". I mean when a user write {family} in his text box, the program must detect it as a key word and replace it with a dynamic fields. In summery i want to edit a text with dynamic fields by user form his panel. can any body help me?
Upvotes: 0
Views: 48
Reputation: 13665
Consider using String.Format
:
string yourString = "Dear {prefix} {name} {family}, thank you for accepting....";
yourString = yourString.Replace("{prefix}","{0}");
yourString = yourString.Replace("{name}","{1}");
yourString = yourString.Replace("{family}","{2}");
string formatedString = String.Format(yourString,prefixVariable,nameVariable,familyVariable);
Upvotes: 1