Can one search for a quote character inside text fields

David Thompson dthmpsn1 at uiuc.edu
Mon Mar 24 07:01:52 PDT 2008


>You guess was correct. I was doing a simple Find/Select.
>I was able to make it work. It does defy my logic. It appears for 
>every " I search for I must enter "". To find """, I enter """""". It
>works.

Behind the scenes, Panorama is using the entries 
you make into that dialog to build a formula. If, 
immediately after you do your search, you choose 
Formula Find/Select... from the Search menu, you 
will see the formula it built.

If you select the A field from the pop-up menu on 
the left, and the Contains operator, and type 
Hello into the text box on the right, then the 
formula that shows up in the Formula 
Find/Select... dialog will be

A contains "Hello"

You see how it has automatically put quotes 
around Hello. If you had simply put " in the text 
box, then when the quotes were added, it would be

A contains """

The first quote would be the opening quote, and 
the second would be the closing quote. The third 
would be a syntax error. Panorama does follow a 
widely used convention for putting quotes in a 
string of text that's quoted by quotes. That 
convention is that every quote in the interior 
must be doubled up, so

A contains """"

will be interpreted as follows. The first quote 
is the opening quote. The last quote is the 
closing quote, and the pair of quotes in the 
middle stand for a single quote. This convention 
applies to any quoted string. It doesn't matter 
if it's part of a search of some kind. If you 
write something like this in a procedure

Message "This is a ""quote"""

the message that appears will say

This is a "quote"

That's kind of an awkward way of doing it. 
Normally, you would just use a different quoting 
character to enclose the text like

Message {This is a "quote"}

The only drawback to this last method is that 
there are occasions where you don't know in 
advance what will go between the quotes, so that 
you don't know what will qualify as a "different" 
quoting character. The trick of using " as the 
quoting character, and then doubling up the 
quotes in the interior will work without 
exception.

Dave


More information about the Qna mailing list