(41 lines)
1 '\" t2 .\" Copyright (c) 2025 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Num.parse 3 2025-11-29 "Tomo man-pages"6 .SH NAME7 Num.parse \- convert text to number8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Num.parse\ :\ func(text:\ Text,\ remainder:\ &Text?\ =\ none\ ->\ Num?)13 .fi14 .SH DESCRIPTION15 Converts a text representation of a number into a floating-point number.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 text Text The text containing the number. -26 remainder &Text? If non-none, this argument will be set to the remainder of the text after the matching part. If none, parsing will only succeed if the entire text matches. none27 .TE28 .SH RETURN29 The number represented by the text or `none` if the entire text can't be parsed as a number.31 .SH EXAMPLES32 .EX33 assert Num.parse("3.14") == 3.1434 assert Num.parse("1e3") == 100035 assert Num.parse("1.5junk") == none36 remainder : Text37 assert Num.parse("1.5junk", &remainder) == 1.538 assert remainder == "junk"39 .EE40 .SH SEE ALSO41 .BR Tomo-Num (3)