Reputation: 1149
I am using an SSIS task that builds an email to fire off to a customer at the completion of an ETL process.
I use an HTML Email Job that then uses a variable to build the body of the email. In this variable I have the HTML Body code to build the page how I like it.
Due to the formatting of HTML with some of the tags it has multiple quotes in it and by multiple I mean several hundred or so.
Is there a way of can place all of this into a string variable with it ignoring the quotation marks?
Ta.
JML
Upvotes: 0
Views: 190
Reputation: 131492
It depends on what you mean `ignore'.
If you mean remove
you can simply call String.Replace with """"
as the argument.
If you mean don't complain
about multiple quotation marks, it probably means you typed the email body as a string literal somewhere and the compiler complains. You should simply escape the quotation marks by prepending "
, ie ""
. This will make managing the string quite difficult though.
A slightly better option is to use '
instead of "
in your HTML. '
is valid in HTML and doesn't have any special meaning in VB so you won't need to escape anything.
A far better solution is to store the literal in a file and load it whenever you need it. This way the compiler won't complain, you won't have to chase after missing quotation marks and editing the template will be much easier
Upvotes: 1
Reputation: 27342
Just use a replace with the double quotes escaped to removed all the double quotes:
Dim htmlString as String = GetEmail.Replace("""","")
Upvotes: 1