mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-02 05:48:17 +00:00
add substringUnsafe roc function
This commit is contained in:
parent
45eb8b9d77
commit
be3800d7fa
9 changed files with 29 additions and 0 deletions
|
|
@ -155,6 +155,7 @@ comptime {
|
|||
exportStrFn(str.strNumberOfBytes, "number_of_bytes");
|
||||
exportStrFn(str.strFromFloatC, "from_float");
|
||||
exportStrFn(str.strEqual, "equal");
|
||||
exportStrFn(str.substringUnsafe, "substring_unsafe");
|
||||
exportStrFn(str.strToUtf8C, "to_utf8");
|
||||
exportStrFn(str.fromUtf8C, "from_utf8");
|
||||
exportStrFn(str.fromUtf8RangeC, "from_utf8_range");
|
||||
|
|
|
|||
|
|
@ -224,3 +224,9 @@ toI8 : Str -> Result I8 [InvalidNumStr]*
|
|||
|
||||
## Gets the byte at the given index, without performing a bounds check
|
||||
getUnsafe : Str, Nat -> U8
|
||||
|
||||
## gives the number of string bytes
|
||||
countBytes : Str -> Nat
|
||||
|
||||
## string slice that does not do bounds checking or utf-8 verification
|
||||
substringUnsafe : Str, Nat, Nat -> Str
|
||||
|
|
|
|||
|
|
@ -324,6 +324,7 @@ pub const STR_TO_INT: IntrinsicName = int_intrinsic!("roc_builtins.str.to_int");
|
|||
pub const STR_TO_FLOAT: IntrinsicName = float_intrinsic!("roc_builtins.str.to_float");
|
||||
pub const STR_TO_DECIMAL: &str = "roc_builtins.str.to_decimal";
|
||||
pub const STR_EQUAL: &str = "roc_builtins.str.equal";
|
||||
pub const STR_SUBSTRING_UNSAFE: &str = "roc_builtins.str.substring_unsafe";
|
||||
pub const STR_TO_UTF8: &str = "roc_builtins.str.to_utf8";
|
||||
pub const STR_FROM_UTF8: &str = "roc_builtins.str.from_utf8";
|
||||
pub const STR_FROM_UTF8_RANGE: &str = "roc_builtins.str.from_utf8_range";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue