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
FN
FN
Level VI

Introducing double quotes "" inside string in JSL (JMP)

I am not sure how to do the following:

 

my_string = "Hello
\!"\!"
World!";

my_string = substitute(my_string , "\!"", """"); // This returns an error

// Expected
// "Hello
// ""
// World!"
1 ACCEPTED SOLUTION

Accepted Solutions
Georg
Level VII

Re: Introducing "" inside string

Where do you want to go with your string?

Inside JSL the escaped double quote (\!") is needed to let JMP know where the string starts and ends.

But if you display that string in a window, or elsewhere, it is like you desired.

 

names default to here(1);
clear log();

my_string = "\[Hello
""
World!]\";

show(my_string);

New Window( "String output window",
Text Box( my_string);
);

// Expected
// "Hello
// ""
// World!"

 

Georg

View solution in original post

5 REPLIES 5
Georg
Level VII

Re: Introducing "" inside string

Where do you want to go with your string?

Inside JSL the escaped double quote (\!") is needed to let JMP know where the string starts and ends.

But if you display that string in a window, or elsewhere, it is like you desired.

 

names default to here(1);
clear log();

my_string = "\[Hello
""
World!]\";

show(my_string);

New Window( "String output window",
Text Box( my_string);
);

// Expected
// "Hello
// ""
// World!"

 

Georg
FN
FN
Level VI

Re: Introducing "" inside string

The idea was to write this string so JMP autogenerates a txt file.
Georg
Level VII

Re: Introducing "" inside string

sorry, I forgot,

and you can use function write, it does what you want.

write(my_string);
Georg
Craige_Hales
Super User

Re: Introducing "" inside string

Yes, write(...) is much less confusing than print(...). Print adds quotation marks that make print pretty useless for printing strings, unless you plan to copy/paste them from the log back into more JSL, in which case all the escaping between the added quotation marks is useful.

Craige
pmroz
Super User

Re: Introducing "" inside string

If I need double quotes inside a string I use the escape sequence \[your-string-goes-here]\.

 

For example:

my_string = "\[Hello
""
World!]\";

write(my_string);

Output:

Hello
""
World!