aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-09 15:11:11 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-09 15:11:11 -0500
commit7a4f2e73addf6dfcde2a6b17b62b961608e556a0 (patch)
treec03e4758e5725a4a6d352f5bb7d323796ed99947 /docs
parent5d35f286336878a3529dabdb3f7800b6f84712eb (diff)
Rename `from_text()` to `parse()`
Diffstat (limited to 'docs')
-rw-r--r--docs/booleans.md10
-rw-r--r--docs/integers.md12
-rw-r--r--docs/nums.md8
-rw-r--r--docs/text.md2
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"
```