乐筑天下

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

[编程交流] write-line to include quote ma

[复制链接]

20

主题

51

帖子

32

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
105
发表于 2022-7-6 17:05:10 | 显示全部楼层 |阅读模式
How does one write double quotes to a file?
 
for example:
 
(write-line "alpha beta alpha beta "delta" alpha beta alpha beta")
 
N.B. delta should have double quote marks, I need it all on one line so this discounts write-char (I think)?
 
Thanks for any help on this
回复

使用道具 举报

0

主题

132

帖子

198

银币

限制会员

铜币
-21
发表于 2022-7-6 17:17:52 | 显示全部楼层
You can concatenate the string using chr(34) wherever you need a quotation. VB recognizes that as the quotation mark.
 
LINK:
http://www.vbforfree.com/?p=312
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 17:39:16 | 显示全部楼层
Check out the 'Control Character in Quoted Strings' topic in the Vlisp help.  It is actually a good one.  
 
At least that's how it is listed in A2K help.  -David
回复

使用道具 举报

5

主题

194

帖子

193

银币

初来乍到

Rank: 1

铜币
24
发表于 2022-7-6 17:43:59 | 显示全部楼层
Following on the above replies, prefix a quote with a backslash to output it as a literal string
 
 
\"delta\" will output as "delta"
 
(write-line "alpha beta alpha beta  \"delta \" alpha beta alpha beta")
 
Regards,
 
Jammie
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 18:00:14 | 显示全部楼层
As in Jammie's example above - the \ (backslash) character prefix will allow the subsequent character to be read as a string instead of a syntax.
 
i.e.
 
\\  =  \
\"  =  "
\n  =  new line
\t  =  tab
 
etc
 
And so, if you want to specify for example a filepath, one must include the double backslash to indicate a single:
 
C:\\Users\\Lee Mac\\Documents....
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 18:11:31 | 显示全部楼层
This may also be a way around another problem of spaces in directory names the path stops at a space using lisp, had to resort to VBA to get around it.
 
C:\\Users\\Lee Mac\\Documents....
or
C:\\Users\\Lee\ Mac\\Documents....
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 19:02 , Processed in 0.329059 second(s), 64 queries .

© 2020-2025 乐筑天下

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