gpt4 book ai didi

string - Swift 是否支持字符串 block ?

转载 作者:搜寻专家 更新时间:2023-10-31 22:03:59 25 4
gpt4 key购买 nike

Ruby、Python 等语言都支持字符串 block 。如:

a = '''
Hello
World
'''

Swift 支持字符串 block 吗?

最佳答案

没有。如 Swift 编程语言介绍的词法结构中所述,string literals包含在一对引号中,并且不得包含换行符。

语法规定:

string-literal → " quoted-text "
quoted-text → quoted-text-item quoted-text opt
quoted-text-item → escaped-character
quoted-text-item → ( expression )
quoted-text-item → Any Unicode extended grapheme cluster except " , \ , U+000A, or U+000D
[...]

其中 U+000A 和 U+000D 分别是换行符和回车符。

目前,没有其他类型的字符串文字

关于string - Swift 是否支持字符串 block ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24020165/

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