KendiKong 发表于 2022-7-5 17:43:13

Quick Question: How to include

Normally in my code, I would put my text inside two quotation marks, but what if i want my text to have quotation marks in them, how to add them in there?
 
 
One more quick question, Is there a way to change a fraction in to a stacked fraction within the line?

BIGAL 发表于 2022-7-5 17:53:57

Q1 The answer is (chr X)
 

(chr 34) = "(chr 35) = # and so on look up the ascii codes(ascii "#") = 35dbl quotes is a bit tricky (ascii "!") = 33!I just look up the listan example(write-line (strcat "    key = "(chr 34) "key1" (chr 34) ";") fo)
 
Q2 look into Mtext and sub / superscripts.

Lee Mac 发表于 2022-7-5 18:11:08

Use the backslash escape character:

(princ "\nAn example using \"quotation marks\" in a string.")

Simon1976 发表于 2022-7-5 18:14:59

Does anyone have a solution to a backslash in an initget-getkword function?
 
At the moment I have:

(initget 1 "WH BK WH/GY WH/BK Other"); these are the 5 options (setq opt (cond((getkword "\nEnter Starting Multicore Colour(s) "))))It doesn't work of course because of the backslashes in the square brackets being interpreted as being separators
They're multicore colours btw

Lee Mac 发表于 2022-7-5 18:28:25

 
You cannot use forward or backslashes in an initget expression, as stated in the developer docs:
 
Therefore, you will need to use hyphens instead, e.g.:
(initget 1 "WH BK WH-GY WH-BK Other")

Simon1976 发表于 2022-7-5 18:40:11

Thanks Lee, that's what I figured.
 
Kinda fudged it by using:
(initget 1 "WH BK WH-GY WH-BK Other") (setq opt (cond((getkword "\nEnter Starting Multicore Colour(s) "))))(cond((= opt "WH")   (setq strg opt))((= opt "BK")   (setq strg opt))((= opt "WH-GY")   (setq strg "WH/GY"))((= opt "WH-BK")   (setq strg "WH/BK"))((= opt "Other")   (setq strg (getstring "\nEnter Starting Multicore Colour(s):")))) so that vl-position can detect the start point in my list of 32 strings

Lee Mac 发表于 2022-7-5 18:48:25

You're welcome Simon -
 
Your code could also be shortened to:
(initget 1 "WH BK WH-GY WH-BK Other")(if (= "Other" (setq strg (vl-string-translate "-" "/" (getkword "\nEnter Starting Multicore Colour(s) : "))))   (setq strg (getstring "\nEnter Starting Multicore Colour(s):")))
页: [1]
查看完整版本: Quick Question: How to include