Introducing "" inside stringI am not sure how to do the following:
my_string = "Hello
\!"\!"
World!";
my_string = substitute(my_string , "\!"", """"); // This returns an error
// Expected
// "Hello
// ""
// World!"
ScriptingRe: Introducing "" inside stringWhere 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!"
Re: Introducing "" inside stringsorry, I forgot,
and you can use function write, it does what you want.
write(my_string);
Re: Introducing "" inside stringYes, 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.
Re: Introducing "" inside stringThe idea was to write this string so JMP autogenerates a txt file.
Re: Introducing "" inside stringIf 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!