diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/booleans.md | 10 | ||||
| -rw-r--r-- | docs/integers.md | 12 | ||||
| -rw-r--r-- | docs/nums.md | 8 | ||||
| -rw-r--r-- | docs/text.md | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/docs/booleans.md b/docs/booleans.md index 4f44931a..80de6fa6 100644 --- a/docs/booleans.md +++ b/docs/booleans.md @@ -7,7 +7,7 @@ Boolean values have the type `Bool` and can be either `yes` ("true") or `no` This documentation provides details on boolean functions available in the API. -## `from_text` +## `parse` **Description:** Converts a string representation of a boolean value into a boolean. Acceptable @@ -16,7 +16,7 @@ boolean values are case-insensitive variations of `yes`/`no`, `y`/`n`, **Signature:** ```tomo -func from_text(text: Text -> Bool?) +func parse(text: Text -> Bool?) ``` **Parameters:** @@ -28,10 +28,10 @@ func from_text(text: Text -> Bool?) **Example:** ```tomo ->> Bool.from_text("yes") +>> Bool.parse("yes") = yes? ->> Bool.from_text("no") +>> Bool.parse("no") = no? ->> Bool.from_text("???") +>> Bool.parse("???") = !Bool ``` diff --git a/docs/integers.md b/docs/integers.md index 16728c44..f5e6838b 100644 --- a/docs/integers.md +++ b/docs/integers.md @@ -154,14 +154,14 @@ The octal string representation of the integer. --- -## `from_text` +## `parse` **Description:** Converts a text representation of an integer into an integer. **Signature:** ```tomo -func from_text(text: Text -> Int?) +func parse(text: Text -> Int?) ``` **Parameters:** @@ -175,17 +175,17 @@ a null value will be returned. **Example:** ```tomo ->> Int.from_text("123") +>> Int.parse("123") = 123? ->> Int.from_text("0xFF") +>> Int.parse("0xFF") = 255? # Can't parse: ->> Int.from_text("asdf") +>> Int.parse("asdf") = !Int # Outside valid range: ->> Int8.from_text("9999999") +>> Int8.parse("9999999") = !Int ``` diff --git a/docs/nums.md b/docs/nums.md index 63fae27f..c7171f37 100644 --- a/docs/nums.md +++ b/docs/nums.md @@ -568,14 +568,14 @@ A text representation of the number with the specified precision. --- -### `from_text` +### `parse` **Description:** Converts a text representation of a number into a floating-point number. **Signature:** ```tomo -func from_text(text: Text -> Num?) +func parse(text: Text -> Num?) ``` **Parameters:** @@ -587,9 +587,9 @@ The number represented by the text or a null value if the entire text can't be p **Example:** ```tomo ->> Num.from_text("3.14") +>> Num.parse("3.14") = 3.14 ->> Num.from_text("1e3") +>> Num.parse("1e3") = 1000 ``` diff --git a/docs/text.md b/docs/text.md index eab07a9e..b0d704b6 100644 --- a/docs/text.md +++ b/docs/text.md @@ -886,7 +886,7 @@ function to each. ```tomo >> "hello world":map($/world/, Text.upper) = "hello WORLD" ->> "Some nums: 1 2 3 4":map($/{int}/, func(i:Text): "$(Int.from_text(i) + 10)") +>> "Some nums: 1 2 3 4":map($/{int}/, func(i:Text): "$(Int.parse(i)! + 10)") = "Some nums: 11 12 13 14" ``` |
