乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 96|回复: 6

[编程交流] Quick Question: How to include

[复制链接]

6

主题

17

帖子

11

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 17:43:13 | 显示全部楼层 |阅读模式
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?
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:53:57 | 显示全部楼层
Q1 The answer is (chr X)
 
  1. (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.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 18:11:08 | 显示全部楼层
Use the backslash escape character:
  1. (princ "\nAn example using "quotation marks" in a string.")
回复

使用道具 举报

6

主题

25

帖子

19

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 18:14:59 | 显示全部楼层
Does anyone have a solution to a backslash in an initget-getkword function?
 
At the moment I have:
  
  1. (initget 1 "WH BK WH/GY WH/BK Other"); these are the 5 options (setq opt (cond((getkword "\nEnter Starting Multicore Colour(s) [WH/BK/WH\/GY/WH\/BK/Other]  "))))
It doesn't work of course because of the backslashes in the square brackets being interpreted as being separators
They're multicore colours btw
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 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.:
  1. (initget 1 "WH BK WH-GY WH-BK Other")
回复

使用道具 举报

6

主题

25

帖子

19

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 18:40:11 | 显示全部楼层
Thanks Lee, that's what I figured.
 
Kinda fudged it by using:
  1.   (initget 1 "WH BK WH-GY WH-BK Other") (setq opt (cond((getkword "\nEnter Starting Multicore Colour(s) [WH/BK/WH-GY/WH-BK/Other]  "))))  (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
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 18:48:25 | 显示全部楼层
You're welcome Simon -
 
Your code could also be shortened to:
  1. (initget 1 "WH BK WH-GY WH-BK Other")(if (= "Other" (setq strg (vl-string-translate "-" "/" (getkword "\nEnter Starting Multicore Colour(s) [WH/BK/WH-GY/WH-BK/Other]: "))))   (setq strg (getstring "\nEnter Starting Multicore Colour(s):")))
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 04:19 , Processed in 0.492351 second(s), 66 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表