Subscribe Bookmark RSS Feed

How to double quote in a string?

djhanson

Community Trekker

Joined:

Jun 23, 2011

Does anyone know the syntax for double-quoting within a string?  The JMP8 scripting guide doesn't make any sense to me as the escape key \!" doesn't yield a quotation mark, but rather itself again.  That's not what I want.

For example, lets say I want to represent a string variable as: ""double quote text", normal text"

myStr = "\!"" || "double quote text" || "\!"" || ", normal text";  ends up yielding "\!"double quote text\!", normal text".  As you can see it's showing the special escape character (\!") which should be the quotation mark only (").

It's probably something dumb I'm missing here...any help or examples appreciated.

thx... dj

1 ACCEPTED SOLUTION

Accepted Solutions
ms

Super User

Joined:

Jun 23, 2011

Solution

The escape syntax remains visible within the JSL context, including the log window. However, when the string containing double quotes is sent to JMP elements the escaped characters are evaluated as expected.

Try the example below. The string is printed as code in the log but passed as strings to the data table (e.g. table name, column name and cell content).

myStr = "\!"double quote text\!", normal text";

Print( myStr );

New Table( myStr ) << add rows( 10 )<< new column(myStr, Character) ;

Column( 2 )[1 :: 10] = myStr;

2 REPLIES
ms

Super User

Joined:

Jun 23, 2011

Solution

The escape syntax remains visible within the JSL context, including the log window. However, when the string containing double quotes is sent to JMP elements the escaped characters are evaluated as expected.

Try the example below. The string is printed as code in the log but passed as strings to the data table (e.g. table name, column name and cell content).

myStr = "\!"double quote text\!", normal text";

Print( myStr );

New Table( myStr ) << add rows( 10 )<< new column(myStr, Character) ;

Column( 2 )[1 :: 10] = myStr;

djhanson

Community Trekker

Joined:

Jun 23, 2011

Excellent!  I started to figure out that the Write statement would correctly display it in the log...but this way you mentioned is just what I need as I am eventually saving this as a text file.  I think this post could be helpful down the road... Thanks again!!  ..dj