View Single Post
  #9   Report Post  
Bob S
 
Posts: n/a
Default

On Wed, 2 Feb 2005 09:35:03 -0800, "Joey"
wrote:

Does anyone know how to include double quotes in the results of an IF
express, as in:

{ IF TextString = "anytext" "This is the "true" result" "This is the "false"
result" }

Any help is greatly appreciated.


Below are a few methods.

Note that it comes out somewhat hard to read in the newsgroup because
both the straight and curly quotes look the same. You will need to use
a bit of imagination to get the picture. The idea is that the quote
marks around the target quotation are supposed to be curly, and the
quote marks that separate portions of the field codes are supposed to
be straight.

Bob S


Quoted Text in IF Fields

Trying to put text that contains embedded quotation marks into the
true or false text of IF field codes can be "interesting". There are a
couple ways to do it. As an example, suppose that you want the output
of an IF field to look like this:

Say "cheese!"

One scheme is to use the QUOTE field to produce the correct quotes.
For example:

{ IF Something "Say { QUOTE "\"" }cheese!{ QUOTE "\"" }" "No!" }

It is inordinately difficult to get this to work. The only way that I
could get the QUOTE fields correct was to use CTRL+F9 to get the
brackets and type directly. Using the Insert | Field dialog produced
straight quotes not curly quotes. Also note that to get the opening
quotes in the first QUOTE field, I typed "\ "" and then deleted the
space character.

Another alternative is to use a pair of single quote characters to
make something that looks somewhat like double quotes:

{ IF Something "Say ''cheese!''" "No!" }

Again, it is unreasonably difficult to get this to work. I had to use
CTRL+F9 to get the brackets (instead of Insert | Field), then type
QUOTE instead of IF (If I used IF I would get straight quotes when I
typed the rest of the text!) and type in the rest of the field, and
then go back and change the QUOTE to IF. Also, to get the two single
opening quotes I had to start with a space between them and then
delete the space.

While you are trying these things, remember to update field codes
every time that you change something.

My favorite scheme at the moment is to first type the correct text,
type QUOTE in front of it, put backslashes in front of the internal
quote characters, add the straight quote characters needed by the
QUOTE field, use CTRL+F9 to put field brackets around it, type in the
rest of the IF field stuff, and then select the whole field code and
use CTRL+F9 to put field brackets around that. It all has to be done
in order.

The process is:

Say "cheese!"
QUOTE Say "cheese!"
QUOTE Say \"cheese!\"
QUOTE "Say \"cheese!\""
{ QUOTE "Say \"cheese!\""}
{ IF Something { QUOTE "Say \"cheese!\""} "No!" }


A different approach was suggested by "macropod". Use the ASCII
numbers for the quote characters, inside QUOTE fields.

{ IF Something "Say { QUOTE 34 }cheese!{ QUOTE 34 }" "No!" }

34 straight double quote
147 left curly double quote
148 right curly double quote
39 straight single quote
145 left curly single quote
146 right curly single quote