Conversions

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.

Tips

Intro

into string turns a number into text.

1 | into string

into int turns digits into a number.

"3" | into int

Basic

into string and into int round-trip a number.

1 | into string | into int

into float and math round meet at an integer.

4 | into float | math round

Intermediate

Text, a count, then text again.

12 | into string | str length | into string

Convert each number inside a closure.

[1 2] | each {|n| $n | into string} | length

Advanced

Four conversions from a number to a count.

12 | into string | str length | into string | str length