mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-01 05:24:15 +00:00
add Str.countBytes
This commit is contained in:
parent
1f943a5452
commit
3cd56c3184
9 changed files with 25 additions and 17 deletions
|
|
@ -146,6 +146,7 @@ comptime {
|
|||
exportStrFn(str.strSplitInPlaceC, "str_split_in_place");
|
||||
exportStrFn(str.countSegments, "count_segments");
|
||||
exportStrFn(str.countGraphemeClusters, "count_grapheme_clusters");
|
||||
exportStrFn(str.countBytes, "count_bytes");
|
||||
exportStrFn(str.startsWith, "starts_with");
|
||||
exportStrFn(str.startsWithScalar, "starts_with_scalar");
|
||||
exportStrFn(str.endsWith, "ends_with");
|
||||
|
|
|
|||
|
|
@ -1184,6 +1184,10 @@ test "countGraphemeClusters: emojis, ut8, and ascii characters" {
|
|||
try expectEqual(count, 10);
|
||||
}
|
||||
|
||||
pub fn countBytes(string: RocStr) callconv(.C) usize {
|
||||
return string.len();
|
||||
}
|
||||
|
||||
// Str.startsWith
|
||||
pub fn startsWith(string: RocStr, prefix: RocStr) callconv(.C) bool {
|
||||
const bytes_len = string.len();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue