diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-12-11 13:50:01 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-12-11 13:52:46 -0500 |
| commit | 7f8f2117799cdfa6b62909a9182b5adade1d0bd2 (patch) | |
| tree | 1db466db870768e952f50572453660e090e434e0 /man/man3/tomo-Int.parse.3 | |
| parent | 630f910563b6f27dd34a4a0496a43d32539eadcb (diff) | |
| parent | 02886fab651d3f64d2c8ded5597e6c075dc69b5f (diff) | |
Merge branch 'dev' into constructive-reals
Diffstat (limited to 'man/man3/tomo-Int.parse.3')
| -rw-r--r-- | man/man3/tomo-Int.parse.3 | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/man/man3/tomo-Int.parse.3 b/man/man3/tomo-Int.parse.3 index d2fc563f..53713c78 100644 --- a/man/man3/tomo-Int.parse.3 +++ b/man/man3/tomo-Int.parse.3 @@ -2,14 +2,14 @@ .\" Copyright (c) 2025 Bruce Hill .\" All rights reserved. .\" -.TH Int.parse 3 2025-11-09 "Tomo man-pages" +.TH Int.parse 3 2025-11-30 "Tomo man-pages" .SH NAME Int.parse \- convert text to integer .SH LIBRARY Tomo Standard Library .SH SYNOPSIS .nf -.BI Int.parse\ :\ func(text:\ Text,\ remainder:\ &Text?\ =\ none\ ->\ Int?) +.BI Int.parse\ :\ func(text:\ Text,\ base:\ Int?\ =\ none,\ remainder:\ &Text?\ =\ none\ ->\ Int?) .fi .SH DESCRIPTION Converts a text representation of an integer into an integer. @@ -23,6 +23,7 @@ lb lb lbx lb l l l l. Name Type Description Default text Text The text containing the integer. - +base Int? The numeric base to use when parsing the integer. If unspecified, the integer's base will be inferred from the text prefix. After any "+" or "-" sign, if the text begins with "0x", the base will be assumed to be 16, "0o" will assume base 8, "0b" will assume base 2, otherwise the base will be assumed to be 10. none 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. none .TE .SH RETURN @@ -42,4 +43,9 @@ assert Int.parse("asdf") == none # Outside valid range: assert Int8.parse("9999999") == none + +# Explicitly specifying base: +assert Int.parse("10", base=16) == 16 .EE +.SH SEE ALSO +.BR Tomo-Int (3) |
