Import std.core.parse
std.core.parse
Parsing numbers and Bools from text.
Text to numbers and Bools: Parse, a Static Method on each, which gives Null for text that isn't one, or a number that doesn't fit. It reads what Format writes, invariantly: '.' for decimals, no thousands, and NaN, Inf, and -Inf for the floats that aren't numbers.
std/core/parse.fb
Extends
Int8
extend
Extend Int8
Reading an Int8 from text.
-
The Int8
textwrites inbase, or Null.
Int16
extend
Extend Int16
Reading an Int16 from text.
-
The Int16
textwrites inbase, or Null.
Int32
extend
Extend Int32
Reading an Int32 from text.
-
The Int32
textwrites inbase, or Null: Int.Parse("42"), Int.Parse("ff", 16).Examples
Expect(Int.Parse("42") == 42) Expect(Int.Parse("-7") == -7) Expect(Int.Parse("ff", 16) == 255) Expect(Int.Parse("4x") == Null)
Int64
extend
Extend Int64
Reading an Int64 from text.
-
The Int64
textwrites inbase, or Null.
UInt8
extend
Extend UInt8
Reading a UInt8 from text.
-
The UInt8
textwrites inbase, or Null.
UInt16
extend
Extend UInt16
Reading a UInt16 from text.
-
The UInt16
textwrites inbase, or Null.
UInt32
extend
Extend UInt32
Reading a UInt32 from text.
-
The UInt32
textwrites inbase, or Null.
UInt64
extend
Extend UInt64
Reading a UInt64 from text.
-
The UInt64
textwrites inbase, or Null.
Float32
extend
Extend Float32
Reading a Float32 from text.
-
The Float32
textwrites, or Null fortextthat isn't a float or one too big for a Float32: Float.Parse("2.5").
Float64
extend
Extend Float64
Reading a Float64 from text.
-
The Float64
textwrites, or Null, which reads back every Float64 that Format writes.Examples
Expect(Double.Parse("2.5") == 2.5) Expect(Double.Parse("1e3") == 1000.0) Expect(Double.Parse("two") == Null)
Bool
extend
Extend Bool
Reading a Bool from text.
-
True for "True", False for "False", and Null for any other text.
Examples
Expect(Bool.Parse("True") == True) Expect(Bool.Parse("yes") == Null)
Report an issue with this page or with FutureBlitz on GitHub.