FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   Quotation marks in a string
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Quotation marks in a string  (Read 1526 times)
inadaze


Quotation marks in a string
« on: Dec 4th, 2004, 11:39pm »

Hi,
i am trying to use the saveStrings(); function to output SMIL code to a text file.  SMIL code looks a lot like XML with things like:  
 
width="310" height="200"
 
inside of tags.  The only problem is how to I include the "quotation marks" inside a string if they are used to indicate the start and end of a string.  Like:
myString = "the stuff inside the string";
 
Thanks
Jay
 
TomC

WWW
Re: Quotation marks in a string
« Reply #1 on: Dec 4th, 2004, 11:52pm »

You should be able to escape quotes in strings with a backslash:
 
Code:

 
println("\"this is in quotes\"");
 
println("only \"this\" is in quotes");
 

 
Hopefully that makes sense.
 
TomC

WWW
Re: Quotation marks in a string
« Reply #2 on: Dec 4th, 2004, 11:54pm »

It's worth noting that because backslash is a special character in strings, you have to double it up if you want to output one.
 
Code:

 
println("here is a backslash: \\");
 
println("here are 2 backslashes: \\\\");
 

 
 
inadaze


Re: Quotation marks in a string
« Reply #3 on: Dec 5th, 2004, 1:07am »

Thanks all!!
 
Pages: 1 

« Previous topic | Next topic »