gpt4 book ai didi

.net - F# 不支持 '\0' 是否有原因?

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

当我尝试使用 '\0' 时作为 F# 中的一个字符,它不起作用。这是我看到的:

enter image description here

我已阅读 elsewhere那个Char.MinValue虽然会完成同样的事情。

有什么原因'\0'不支持?

最佳答案

F# specification描述字 rune 字的语法:

3.5 字符串和字符

regexp escape-char= '\' ["\'ntbrafv]

regexp non-escape-chars= '\' [^"\'ntbrafv]

regexp simple-char-char= | (any char except '\n' '\t' '\r' '\b' '\a' '\f' '\v' ' \")

regexp unicodegraph-short = '\''u' hexdigit hexdigit hexdigit hexdigit

regexp unicodegraph-long= '\''U' hexdigit hexdigit hexdigit hexdigit hexdigit hexdigit hexdigit hexdigit

regexp trigraph = '\' digit-char digit-char digit-char

regexp char-char= | simple-char-char | escape-char | trigraph | unicodegraph-short


\0不匹配这些 - 如果你想要空字符,你可以使用
let c = '\000'

Char.MinValue

关于.net - F# 不支持 '\0' 是否有原因?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62091185/

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