Merge String with Variables

  • Thread starter Thread starter Joe Fallon
  • Start date Start date
J

Joe Fallon

I know that String.Format has the ability to format a string using
placeholders like {0}, {1}, {2} etc.

Is there a way to make a template that uses variables like <% MyVar1 %>
instead of {0}?
(The sole purpose is to increase readability. I will use {0} if there is no
other option.)

e.g.

"This is my template and this value is <% MyVar1 %> and the next value is <%
MyVar2 %>"

Then if I have MyVar1 and MyVar2 in code I want to merge them with the
template to get the final string value.
 
Not sure if I totally understand the question...but you might want to check out the use of
Strings.Format()
This has many overloaded options that could help you make this work...

Robert Schoen (Microsoft Visual Basic QA)
--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top