mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add WString.len
This commit is contained in:
committed by
Christoffer Lerno
parent
af91f35017
commit
8df112e157
@@ -622,12 +622,17 @@ fn usz ZString.char_len(str)
|
||||
|
||||
fn usz ZString.len(self)
|
||||
{
|
||||
usz len = 0;
|
||||
char* ptr = (char*)self;
|
||||
while (char c = ptr++[0]) len++;
|
||||
usz len;
|
||||
for (char* ptr = (char*)self; *ptr; ptr++) len++;
|
||||
return len;
|
||||
}
|
||||
|
||||
fn usz WString.len(self)
|
||||
{
|
||||
usz len;
|
||||
for (Char16* ptr = (Char16*)self; *ptr; ptr++) len++;
|
||||
return len;
|
||||
}
|
||||
|
||||
fn ZString String.zstr_copy(self, Allocator allocator)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user