Spec-Zone.ru › Nushell

format number for conversions

Format a number.

Signature

> format number {flags}

Flags

  • --no-prefix, -n: Don't include the binary, hex or octal prefixes.

Input/output types:

input output
number record

Examples

Get a record containing multiple formats for the number 42

> 42 | format number
╭──────────┬──────────╮
│ debug    │ 42       │
│ display  │ 42       │
│ binary   │ 0b101010 │
│ lowerexp │ 4.2e1    │
│ upperexp │ 4.2E1    │
│ lowerhex │ 0x2a     │
│ upperhex │ 0x2A     │
│ octal    │ 0o52     │
╰──────────┴──────────╯

Format float without prefixes

> 3.14 | format number --no-prefix
╭──────────┬─────────────────────────────────────────────────────────────────╮
│ debug    │ 3.14                                                            │
│ display  │ 3.14                                                            │
│ binary   │ 100000000001001000111101011100001010001111010111000010100011111 │
│ lowerexp │ 3.14e0                                                          │
│ upperexp │ 3.14E0                                                          │
│ lowerhex │ 40091eb851eb851f                                                │
│ upperhex │ 40091EB851EB851F                                                │
│ octal    │ 400110753412172702437                                           │
╰──────────┴─────────────────────────────────────────────────────────────────╯

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/format_number.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API