mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
add substringUnsafe roc function
This commit is contained in:
parent
45eb8b9d77
commit
be3800d7fa
9 changed files with 29 additions and 0 deletions
|
@ -82,6 +82,7 @@ pub fn builtin_defs_map(symbol: Symbol, var_store: &mut VarStore) -> Option<Def>
|
|||
STR_ENDS_WITH => str_ends_with,
|
||||
STR_COUNT_GRAPHEMES => str_count_graphemes,
|
||||
STR_COUNT_BYTES=> str_count_bytes,
|
||||
STR_SUBSTRING_UNSAFE => str_substring_unsafe,
|
||||
STR_FROM_UTF8 => str_from_utf8,
|
||||
STR_FROM_UTF8_RANGE => str_from_utf8_range,
|
||||
STR_TO_UTF8 => str_to_utf8,
|
||||
|
@ -1731,6 +1732,11 @@ fn str_count_bytes(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
|||
lowlevel_1(symbol, LowLevel::StrCountBytes, var_store)
|
||||
}
|
||||
|
||||
/// Str.substringUnsafe : Str, Nat, Nat -> Nat
|
||||
fn str_substring_unsafe(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
lowlevel_1(symbol, LowLevel::StrSubstringUnsafe, var_store)
|
||||
}
|
||||
|
||||
/// Str.fromUtf8 : List U8 -> Result Str [BadUtf8 { byteIndex : Nat, problem : Utf8Problem } }]*
|
||||
fn str_from_utf8(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||
let bytes_var = var_store.fresh();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue