aboutsummaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-09 05:31:25 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-09 05:31:25 -0400
commite16792d5eb76326634cb1ad0b21301ec693fccb3 (patch)
tree99e5b5c53db39e173db2b82db87cef85cd267c60 /environment.c
parent319d4306b585569d198a6e0ac268c009eb63705a (diff)
Add Text.starts_with() and Text.ends_with()
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/environment.c b/environment.c
index d51d9aa1..b17d12a0 100644
--- a/environment.c
+++ b/environment.c
@@ -275,10 +275,11 @@ env_t *new_compilation_unit(CORD *libname)
{"run", "Shell$run", "func(command:Shell, status=!&Int32?)->Text"},
)},
{"Text", TEXT_TYPE, "Text_t", "Text$info", TypedArray(ns_entry_t,
- {"find", "Text$find", "func(text:Text, pattern:Pattern, start=1, length=!&Int64)->Int"},
- {"find_all", "Text$find_all", "func(text:Text, pattern:Pattern)->[Text]"},
{"as_c_string", "Text$as_c_string", "func(text:Text)->CString"},
{"codepoint_names", "Text$codepoint_names", "func(text:Text)->[Text]"},
+ {"ends_with", "Text$ends_with", "func(text:Text, suffix:Text)->Bool"},
+ {"find", "Text$find", "func(text:Text, pattern:Pattern, start=1, length=!&Int64)->Int"},
+ {"find_all", "Text$find_all", "func(text:Text, pattern:Pattern)->[Text]"},
{"from_bytes", "Text$from_bytes", "func(bytes:[Int8])->Text"},
{"from_c_string", "Text$from_str", "func(str:CString)->Text"},
{"from_codepoint_names", "Text$from_codepoint_names", "func(codepoint_names:[Text])->Text"},
@@ -293,8 +294,9 @@ env_t *new_compilation_unit(CORD *libname)
{"repeat", "Text$repeat", "func(text:Text, count:Int)->Text"},
{"replace", "Text$replace", "func(text:Text, pattern:Pattern, replacement:Text, backref=$/\\/, recursive=yes)->Text"},
{"replace_all", "Text$replace_all", "func(text:Text, replacements:{Pattern:Text}, backref=$/\\/, recursive=yes)->Text"},
- {"split", "Text$split", "func(text:Text, pattern=$Pattern'')->[Text]"},
{"slice", "Text$slice", "func(text:Text, from=1, to=-1)->Text"},
+ {"split", "Text$split", "func(text:Text, pattern=$Pattern'')->[Text]"},
+ {"starts_with", "Text$starts_with", "func(text:Text, prefix:Text)->Bool"},
{"title", "Text$title", "func(text:Text)->Text"},
{"trim", "Text$trim", "func(text:Text, pattern=$/{whitespace}/, trim_left=yes, trim_right=yes)->Text"},
{"upper", "Text$upper", "func(text:Text)->Text"},