aboutsummaryrefslogtreecommitdiff
path: root/stdlib/text.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-19 13:50:35 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-19 13:50:35 -0500
commitb0faa5adc2c5f56ae50cf21f855fa6805db926cf (patch)
treef79e21230108b45843c0bf21c32b08d814802917 /stdlib/text.c
parent1db70d46c62c9478ea84ccff204fb315136e518c (diff)
Add Text:from()/to() and Array:slice() for symmetry
Diffstat (limited to 'stdlib/text.c')
-rw-r--r--stdlib/text.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/stdlib/text.c b/stdlib/text.c
index 4879ead9..384bf7ac 100644
--- a/stdlib/text.c
+++ b/stdlib/text.c
@@ -562,6 +562,16 @@ public Text_t Text$slice(Text_t text, Int_t first_int, Int_t last_int)
}
}
+public Text_t Text$from(Text_t text, Int_t first)
+{
+ return Text$slice(text, first, I_small(-1));
+}
+
+public Text_t Text$to(Text_t text, Int_t last)
+{
+ return Text$slice(text, I_small(1), last);
+}
+
public Text_t Text$cluster(Text_t text, Int_t index_int)
{
int64_t index = Int_to_Int64(index_int, false);