mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
simplify str_starts_with
This commit is contained in:
parent
770d4d7bc3
commit
f21af47fc1
2 changed files with 14 additions and 76 deletions
|
@ -576,7 +576,13 @@ test "countGraphemeClusters: emojis, ut8, and ascii characters" {
|
|||
|
||||
// Str.startsWith
|
||||
|
||||
pub fn startsWith(bytes_ptr: [*]u8, bytes_len: usize, prefix_ptr: [*]u8, prefix_len: usize) callconv(.C) bool {
|
||||
pub fn startsWith(string: RocStr, prefix: RocStr) callconv(.C) bool {
|
||||
const bytes_len = string.len();
|
||||
const bytes_ptr = string.as_u8_ptr();
|
||||
|
||||
const prefix_len = prefix.len();
|
||||
const prefix_ptr = prefix.as_u8_ptr();
|
||||
|
||||
if (prefix_len > bytes_len) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue