This Microsoft 支持页面显示没有与 C 运行时的 isdigit() 等效的 Win32。

但是有 IsCharAlphaNumericIsCharAlpha

直觉上,这让我想到:IsCharAlphaNumeric() && !IsCharAlpha() 等价于(不存在的)IsCharNumeric()
但我可能错过了一些东西......

我可以安全地假设上述内容是正确的吗?

最佳答案

在不知道 IsCharAlphaNumeric()IsCharAlpha() 的语义的情况下,无法确定是否

IsCharNumeric(c) == (IsCharAlphaNumeric(c) && !IsCharAlpha(c))

适用于所有 c 。它不成立可能是合理的,例如十六进制数字可以是数字和字母。

换句话说,你不能安全地假设等价。

关于c - IsCharAlphaNumeric && !IsCharAlpha == IsCharNumeric?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8912071/

10-13 05:35