12345678910111213141516171819202122232425262728293031323334353637 | '\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Num.parse 3 2026-08-27 "Tomo man-pages"
.SH NAME
Num.parse \- parse text as a number
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Num.parse\ :\ func(text:\ Text\ ->\ Num?)
.fi
.SH DESCRIPTION
The exact number a piece of text denotes. Both decimals and fractions are accepted, and both are read exactly: "0.1" is a tenth, not the nearest float to one.
.SH ARGUMENTS
.TS
allbox;
lb lb lbx
l l l.
Name Type Description
text Text The text to parse.
.TE
.SH RETURN
The number, or `none` if the text isn't one.
.SH EXAMPLES
.EX
assert Num.parse("0.1")! == 0.1
assert Num.parse("22/7")! == 22./7.
assert Num.parse("nope") == none
.EE
.SH SEE ALSO
.BR Tomo-Num (3)
|