Richard Comito
asked on
How can I replace a double quote at the begging of the string and at the end of the string?
I have the following code that I am using to write a string to an HTML File. However, when the string is written to the file I get a double quote at the begging of the string and one at the end of the string. I would like to just replace those two quotes without replacing all the quotes in the entire string. How would I go about doing this?
This is the line that I am having trouble with. " Write(4, Replace(strTopEmail.ToStri ng, chr(34), "", 1, 1, CompareMethod.Text) + strBottomEmail + strEmailBody2 + strEmailUnsubScribe + strEmailFooter)"
Thanks
If intCount = 1 Then
If File.Exists("\\192.168.0.3 0\c$\websi te\LASA2\w eeklyemail \default.h tml") Then
File.Delete("\\192.168.0.3 0\c$\websi te\LASA2\w eeklyemail \default.h tml")
FileOpen(4, "\\192.168.0.30\c$\website \LASA2\wee klyemail\d efault.htm l", OpenMode.Append, OpenAccess.Write)
Write(4, Replace(strTopEmail.ToStri ng, chr(34)", "", 1, 1, CompareMethod.Text) + strBottomEmail + strEmailBody2 + strEmailUnsubScribe + strEmailFooter)
FileClose(4)
Else
FileOpen(4, "\\192.168.0.30\c$\website \LASA2\wee klyemail\d efault.htm l", OpenMode.Append, OpenAccess.Write)
Write(4, strTopEmail + strBottomEmail + strEmailBody2 + strEmailUnsubScribe + strEmailFooter)
FileClose(4)
End If
End If
This is the line that I am having trouble with. " Write(4, Replace(strTopEmail.ToStri
Thanks
If intCount = 1 Then
If File.Exists("\\192.168.0.3
File.Delete("\\192.168.0.3
FileOpen(4, "\\192.168.0.30\c$\website
Write(4, Replace(strTopEmail.ToStri
FileClose(4)
Else
FileOpen(4, "\\192.168.0.30\c$\website
Write(4, strTopEmail + strBottomEmail + strEmailBody2 + strEmailUnsubScribe + strEmailFooter)
FileClose(4)
End If
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
from MSDN
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmWrite.asp?frame=true
Unlike the Print function, the Write function inserts commas between items and quotation marks around strings as they are written to the file. You don't have to put explicit delimiters in the list.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vastmWrite.asp?frame=true
Unlike the Print function, the Write function inserts commas between items and quotation marks around strings as they are written to the file. You don't have to put explicit delimiters in the list.
ASKER
Thanks fernando for your reply.
However I am getting the following error when I try and use your suggestion.
("Replace" is not a member of RegularExpressions)
However I am getting the following error when I try and use your suggestion.
("Replace" is not a member of RegularExpressions)
ASKER
Thanks appari,
That did the trick and the expiation helped also.
That did the trick and the expiation helped also.
if the following line of code outputs one line to the HTML file, meanning no CrLf in the line:
Replace(strTopEmail.ToStri
Then this line of code will do what you want.
System.Text.RegularExpress
I hope that this is of some help.
Fernando