Rank: Member
Groups: Approved
Joined: 6/8/2019(UTC) Posts: 8 Thanks: 1 times
|
I'm trying to create a list of text that I can type quickly when I need it,but encountered a problem, 1、When there are quotation marks in the text,The text will be invalid, how to describe it correctly? 2、How to describe correctly when there are multiple paragraphs in the text? Thanks my brothers and sisters 👍
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
The scripting engine is JavaScript, so the same rules apply. See here for some basic information: https://www.w3schools.com/js/js_strings.aspCode:// Use double-quotes around the main text so single ticks can be used within
sp.SendUnicodeString("Whether it's a faster route to work");
// Escape the single tick
sp.SendUnicodeString('Whether it\'s a faster route to work');
// Use backticks instead of single or double-quotes
sp.SendUnicodeString(`Whether it's a faster route to work`);
// Add a new line escape (\n) at the end of each paragraph
sp.SendUnicodeString("first paragraph first paragraph first paragraph first paragraph\nsecond paragraph second paragraph second paragraph\nthird paragraph third paragraph third paragraph");
// Use backticks to create a literal string
sp.SendUnicodeString(`first paragraph first paragraph first paragraph first paragraph
second paragraph second paragraph second paragraph
third paragraph third paragraph third paragraph`);
Actually - since it looks like you're already using the menu script inside of backticks, it would be best to use one of the other methods above which aren't using backticks. Things can get very complicated with nested strings!
|
1 user thanked Rob for this useful post.
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close