Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with printing quotation marks within a string

Status
Not open for further replies.

shakes

Programmer
Nov 10, 2000
1
CA
I am getting reacquainted with Basic programming and can't remember nor find the answer to how to print or print to a file quotation marks within a string. I am trying to print some lines of HTML and in some places quotation marks are required to be read by the browser.

PRINT &quot;<FONT COLOR=&quot;#777777&quot;> This color is? </FONT>

for instance won't work. Any help would be appreciated.
 
PRINT &quot;<FONT COLOR=&quot; + chr$(34) + &quot;#777777&quot;> This color is? </FONT>



David Paulson


 
also if your HTML code is in a buffer than you should have no problem copying directly to a file using the PUT statement.

make a buffer, buffer$=string$(10000,0)

this would put the quotations in automatically, but if you're getting your HTML from user input then you would probably need to trim the string RTRIM$(buffer$) so not to waste space or skew the formatting. either way I think this method is simpler because you don't have to scan the string for quotation marks.
 
oh sorry for being so uninflective. the biggest problem you are having is because when you input a quotation it comes out as a space in your string?

there is probably a better way to do this but the way I use
is to use INKEY$ instead of INPUT.

like this

'get user input

DO

DO
loop until INKEY$<>&quot;&quot;

MID$(Buffer$,X,1) = INKEY$

LOOP UNTIL <however you want to stop or go down to the next line>


You don't get a blinking cursor this way but you could make one easy enough.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top