(43 lines)
1 '\" t2 .\" Copyright (c) 2026 Bruce Hill3 .\" All rights reserved.4 .\"5 .TH Byte.parse 3 2026-03-08 "Tomo man-pages"6 .SH NAME7 Byte.parse \- convert text to a byte8 .SH LIBRARY9 Tomo Standard Library10 .SH SYNOPSIS11 .nf12 .BI Byte.parse\ :\ func(text:\ Text,\ base:\ Int?\ =\ none,\ remainder:\ &Text?\ =\ none\ ->\ Byte?)13 .fi14 .SH DESCRIPTION15 Parse a byte literal from text.18 .SH ARGUMENTS20 .TS21 allbox;22 lb lb lbx lb23 l l l l.24 Name Type Description Default25 text Text The text to parse. -26 base Int? The numeric base to use when parsing the byte. If unspecified, the byte'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. none27 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. none28 .TE29 .SH RETURN30 The byte parsed from the text, if successful, otherwise `none`.32 .SH EXAMPLES33 .EX34 assert Byte.parse("5") == Byte(5)35 assert Byte.parse("asdf") == none36 assert Byte.parse("123xyz") == none38 remainder : Text39 assert Byte.parse("123xyz", remainder=&remainder) == Byte(123)40 assert remainder == "xyz"41 .EE42 .SH SEE ALSO43 .BR Tomo-Byte (3)