powershell - PowerShell中数字后缀的完整列表是什么?

标签 powershell number-literal

您可以在PowerShell数字文字上使用的后缀的完整列表是什么?
到目前为止,我发现:

╔════════╦═════════╦════════════════════════╗
║ Suffix ║ Example ║         Result         ║
╠════════╬═════════╬════════════════════════╣
║   L    ║   1L    ║ Type = Int64           ║
║   D    ║   1D    ║ Type = Decimal         ║
║   KB   ║   1KB   ║ 1KB = 1024             ║
║   MB   ║   1MB   ║ 1MB = 1048576          ║
║   GB   ║   1GB   ║ 1GB = 1073741824       ║
║   TB   ║   1TB   ║ 1TB = 1099511627776    ║
║   PB   ║   1PB   ║ 1PB = 1125899906842624 ║
╚════════╩═════════╩════════════════════════╝

但是我找不到列出所有这些资源的来源。

最佳答案

根据PowerShell Language Specification (V3)这是完整的集合。

  • §2.3.5.1.1整数文字包括:lkbmbgbtbpb
  • §2.3.5.1.2实际文字添加了d

  • 据我所知(尚未发布该规范的更新)PowerShell V4不会再添加任何后缀。

    关于powershell - PowerShell中数字后缀的完整列表是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24474017/

    相关文章:

    powershell - 对象输出的奇怪延迟后跟开始 sleep (或直到脚本结束)

    powershell - 如何通过自动化运行 PowerShell 脚本而不会遇到主机问题

    ruby - 以 `0` 为前缀的数字文字

    python - 确定 Python 数字文字代表的 Number 的 Kind (int, float)?

    kotlin - 为什么 kotlin 不接受文字 "-9223372036854775808"(最小 64 位有符号整数)?

    forms - PowerShell 取消按钮停止脚本

    powershell - 获取 GenericList 中重复项的计数

    powershell - 将本地内容上传到 SharePoint Online 如何检索日志(使用 powershell)