cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
djhanson
Level V

How to double quote in a string?

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 (Alumni) ms
Super User (Alumni)

Re: How to double quote in a string?

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;

 

View solution in original post

2 REPLIES 2
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to double quote in a string?

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
Level V

How to double quote in a string?

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