gpt4 book ai didi

forth - 在 Forth 中打印双引号

转载 作者:行者123 更新时间:2023-12-04 12:31:20 25 4
gpt4 key购买 nike

."打印一个字符串。更准确地说,它编译了 (.")和字符串直到下一个 "在当前编译的单词中。
但是我怎么打印

That's the "question".


与 Forth?

最佳答案

在 Forth-2012 系统(例如 Gforth)中,您可以使用字符串文字并通过单词 s\" 进行转义作为:

: foo ( -- ) s\" That's the \"question\"." type ;
在 Forth-94 系统(大多数标准系统)中,您可以使用任意解析和单词 sliteral 作为:
: foo ( -- ) [ char | parse That's the "question".| ] sliteral type ;
字符串也可以提取到行尾(没有可打印的分隔符);也可以提取多行字符串。
可以轻松定义特定情况的特定助手。
例如,看到单词 s$ 对于由任意可打印字符分隔的字符串文字,例如:
  s$ `"test" 'passed'` type

关于forth - 在 Forth 中打印双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68837072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com