Writing Double Quotes within a String Question 
Author Message
 Writing Double Quotes within a String Question

I have a script in which I am writing a text string to a text file using
WriteLine as follows:
....
results.WriteLine "If InStr(1, strAddr, '://') = 0 Then"
results.WriteLine "   strAddr = 'http://' & strAddr"
results.WriteLine "End If"

In the .hta file that is being creating that has the above code snippet in
it I want it to appear as follows:

If InStr(1, strAddr, "://") = 0 Then
   strAddr = "http://" & strAddr
End If

My Question : How do I get this line of code to write correctly with
double-quotes to the .hta? It currently is writing with single quotes which
obviously is incorrect. I have tried various combinations of
quotes/double-quotes but don't seem to be able to figure it out.

Any help or information will be greatly appreciated. TIA



Thu, 07 Feb 2002 03:00:00 GMT  
 Writing Double Quotes within a String Question
Within a quoted string, the simplelest solution is to use two double-quotes to
represent one double-quote.  This is true for VB/VBA/VBScript.

| results.WriteLine "If InStr(1, strAddr, ""://"") = 0 Then"
| results.WriteLine "   strAddr = ""http://"" & strAddr"
| results.WriteLine "End If"

--
Michael Harris


| I have a script in which I am writing a text string to a text file using
| WriteLine as follows:
| ....
| results.WriteLine "If InStr(1, strAddr, '://') = 0 Then"
| results.WriteLine "   strAddr = 'http://' & strAddr"
| results.WriteLine "End If"
|
| In the .hta file that is being creating that has the above code snippet in
| it I want it to appear as follows:
|
| If InStr(1, strAddr, "://") = 0 Then
|    strAddr = "http://" & strAddr
| End If
|
| My Question : How do I get this line of code to write correctly with
| double-quotes to the .hta? It currently is writing with single quotes which
| obviously is incorrect. I have tried various combinations of
| quotes/double-quotes but don't seem to be able to figure it out.
|
| Any help or information will be greatly appreciated. TIA
|



Thu, 07 Feb 2002 03:00:00 GMT  
 Writing Double Quotes within a String Question
You need double-double quotes to write a double-qoute to a string. The
following code should do it:

results.WriteLine "If InStr(1, strAddr, ""://"") = 0 Then"
results.WriteLine "   strAddr = ""http://"" & strAddr"

---
  Anders Heick


Quote:
> I have a script in which I am writing a text string to a text file using
> WriteLine as follows:
> ....
> results.WriteLine "If InStr(1, strAddr, '://') = 0 Then"
> results.WriteLine "   strAddr = 'http://' & strAddr"
> results.WriteLine "End If"

> In the .hta file that is being creating that has the above code snippet in
> it I want it to appear as follows:

> If InStr(1, strAddr, "://") = 0 Then
>    strAddr = "http://" & strAddr
> End If

> My Question : How do I get this line of code to write correctly with
> double-quotes to the .hta? It currently is writing with single quotes
which
> obviously is incorrect. I have tried various combinations of
> quotes/double-quotes but don't seem to be able to figure it out.

> Any help or information will be greatly appreciated. TIA



Fri, 08 Feb 2002 03:00:00 GMT  
 Writing Double Quotes within a String Question
Thanks Guys!

I have a script in which I am writing a text string to a text file using
WriteLine as follows:
....
results.WriteLine "If InStr(1, strAddr, '://') = 0 Then"
results.WriteLine "   strAddr = 'http://' & strAddr"
results.WriteLine "End If"

In the .hta file that is being creating that has the above code snippet in
it I want it to appear as follows:

If InStr(1, strAddr, "://") = 0 Then
   strAddr = "http://" & strAddr
End If

My Question : How do I get this line of code to write correctly with
double-quotes to the .hta? It currently is writing with single quotes which
obviously is incorrect. I have tried various combinations of
quotes/double-quotes but don't seem to be able to figure it out.

Any help or information will be greatly appreciated. TIA



Fri, 08 Feb 2002 03:00:00 GMT  
 Writing Double Quotes within a String Question
Try this:

results.WriteLine "If InStr(1, strAddr, ""://"") = 0 Then"
results.WriteLine "   strAddr = ""http://"" & strAddr"
results.WriteLine "End If"


Quote:
> Thanks Guys!


> I have a script in which I am writing a text string to a text file using
> WriteLine as follows:
> ....
> results.WriteLine "If InStr(1, strAddr, '://') = 0 Then"
> results.WriteLine "   strAddr = 'http://' & strAddr"
> results.WriteLine "End If"

> In the .hta file that is being creating that has the above code snippet in
> it I want it to appear as follows:

> If InStr(1, strAddr, "://") = 0 Then
>    strAddr = "http://" & strAddr
> End If

> My Question : How do I get this line of code to write correctly with
> double-quotes to the .hta? It currently is writing with single quotes
which
> obviously is incorrect. I have tried various combinations of
> quotes/double-quotes but don't seem to be able to figure it out.

> Any help or information will be greatly appreciated. TIA



Fri, 08 Feb 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. writing double quote with escape sequence in string?

2. Simple string and double quote question...

3. writing out double quotes in Response.Write

4. WScript.Arguments won't parse double-quotes within arguments

5. Double quotes in string

6. string with single and double quote

7. Double quotes in string??

8. Cant display string with double quotes in INPUT box

9. Using the double quotes in a string.

10. Double Quotes, Then Single Quotes, what comes next?

11. Double Quotes, Then Single Quotes, what comes next?

12. Double Quotes, Then Single Quotes, what comes next?

 

 
Powered by phpBB® Forum Software