在字符串中引入“”我不確定如何執行以下操作:
my_string = "Hello
\!"\!"
World!";
my_string = substitute(my_string , "\!"", """"); // This returns an error
// Expected
// "Hello
// ""
// World!"
腳本編寫回复:在字符串中引入“”您想把弦放在哪裡?
在JSL中,需要轉義的雙引號(\!“)才能讓JMP知道字符串的開始和結束位置。
但是,如果您在窗口或其他地方顯示該字符串,則就像您想要的那樣。
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!"
回复:在字符串中引入“”對不起我忘記了,
您可以使用函數寫入功能來完成您想要的操作。
write(my_string);
回复:在字符串中引入“”是的,write(...)比print(...)混亂得多。 Print添加引號使打印對於打印字符串幾乎沒有用,除非您計劃將它們從日誌中復制/粘貼回更多的JSL,在這種情況下,添加引號之間的所有轉義都是有用的。
回复:在字符串中引入“”想法是編寫此字符串,以便JMP自動生成txt文件。
回复:在字符串中引入“”如果我需要在字符串中使用雙引號,請使用轉義序列\ [your-string-goes-here] \。
例如:
my_string = "\[Hello
""
World!]\";
write(my_string);
輸出:
Hello
""
World!